On 2/25/03 1:36 AM, "Brion Vibber" brion@pobox.com wrote:
On lun, 2003-02-24 at 22:09, Jay Bowks wrote:
Hey Brion, thanks so much for doing all the work of redirecting the Wiktionary entries. How'd you change the caps so quick ? :-)))
The magic of perl scripts!
while( $x = <> ) { $x =~ s/^([[[A-Z ()]+]])/lc "$1"/e; print $x; }
Because I love syntactic sugar, I can't help saying that the above can be reduced to
while(<>) { s/^([[[A-Z ()]+]])/lc $1/e; print }
Or, using the -p tag:
perl -p -e "s/^([[[A-Z ()]+]])/lc $1/e"
to get that sedlike functionality.
On mar, 2003-02-25 at 07:39, The Cunctator wrote:
Because I love syntactic sugar, I can't help saying that the above can be reduced to
while(<>) { s/^([[[A-Z ()]+]])/lc $1/e; print }
Or, using the -p tag:
perl -p -e "s/^([[[A-Z ()]+]])/lc $1/e"
I, on the other hand, like to be able to read my scripts when I come back to them later. ;)
-- brion vibber (brion @ pobox.com)
The Cunctator wrote:
Because I love syntactic sugar, I can't help saying that the above can be reduced to
while(<>) { s/^([[[A-Z ()]+]])/lc $1/e; print }
And people think I'm joking when I tell them that good Perl looks like someone fell asleep on the keyboard ;-)
wikitech-l@lists.wikimedia.org