Choosing Perl/Python for my particular niche

Peter Hickman peter at semantico.com
Tue Mar 30 10:49:44 CEST 2004


Fred Ma wrote:
> I appreciate the sed terseness because
> I can make a command line pipe stage out of it, but
> the same brevity in a scripting language can make for
> rough going.

Both perl and python will allow you to do this. in perl

#!/usr/bin/perl
while(<>) { print uc $_; }

this script will read from stdin and write an uppercased version of the 
input to stdout and can be used in a pipeline.

You can to the same in python and of course the guts of the loop can be 
as big or small as you like. There is also a s2p tool that converts sed 
scripts into perl, but rewiting would be a better bet as s2p can produce 
some crufty code.

To be honest you could just flip a coin and go with that if you have no 
specific requirements.

Perl may be easier to sell to your boss than python but if you just went 
ahead with it you could use anything.



More information about the Python-list mailing list