SPUG: Inspired, broken.

jlb jlb at io.com
Wed Feb 9 14:17:38 PST 2005


On Wed, 9 Feb 2005, Atom Powers wrote:
>> The only thing close was -i, which isn't really waht you want.
>
> I toyed with the idea of something like this:
> /usr/bin/perl5 -wnl -e 'm/\w+\@\w+\.\w{3}/ and 
> open(DATA,">","recipients.txt") and print DATA "\L$&\E OK";' 
> /usr/home/mailman/address_list.txt
>
> But I didn't know if reopening the file with every match would cause a 
> problem.

It most likely wouldn't break, but it's certainly a bit ugly.  Using -n, I 
believe you can use BEGIN and END blocks to open and close the file, (see 
the perldoc perlrun section about -n) but I was hoping there'd be 
something a little nicer or shorter to use in a "one-liner" format.

Jon


More information about the spug-list mailing list