c:\test>type echoit.pl
#! perl -sw
use strict;
print while <>;
c:\test>echoit <junk.dat
jim 14
john 23
ernest 38
matilda 43
jim 34
ernest 27
john 44
matilda 22
c:\test>echoit <junk.dat >junk.out
c:\test>type junk.out
jim 14
john 23
ernest 38
matilda 43
jim 34
ernest 27
john 44
matilda 22
c:\test>echoit <junk.dat | find "j"
jim 14
john 23
jim 34
john 44
The only (minor) inconvenience is for input piping you need to prefix the script name with 'perl':
c:\test>type junk.dat | perl echoit.pl
jim 14
john 23
ernest 38
matilda 43
jim 34
ernest 27
john 44
matilda 22
But that's more than compensated for by not having to deal with the .bat nanny prompt:
Terminating on signal SIGINT(2)
Terminate batch job (Y/N)?
And far outweighed by not having to remember to re-pl2bat if you edit the thing.
But most of all, being able to add perl switches to the command line:
perl -c script.pl
perl -d:Trace script.pl
perl -X script.pl
And finally, use perl's built-in switch parsing:
script -S=this -T=that
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|