Choosing Perl/Python for my particular niche
Fred Ma
fma at doe.carleton.ca
Tue Mar 30 17:17:38 EST 2004
Peter Hickman wrote:
>
> 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.
Hi, Peter,
My boss is my thesis supervisor. I'm going with Perl and keeping a
tab on Python. I expect to do most of my hacking in Perl, since I
see it around everywhere, composing in Python, and one-liners in
Perl/sed. About invoking Perl as part of a simple command in a
pipeline, I mean that one doesn't even have to write a script for it,
similar to sed
Command1 | sed -e Expression1 -e Expression2 ... | Command_N
This might also be possible in Python, in which case so much the better.
I'll find out (or someone might answer in a follow-up post). Thanks
for your view on the two.
Fred
--
Fred Ma
Dept. of Electronics, Carleton University
1125 Colonel By Drive, Ottawa, Ontario
Canada, K1S 5B6
More information about the Python-list
mailing list