Perl from the command line

Linux, Perl

hostname:$ perl -e 'put script here;' args go here

to have each line processed by the script use -n or -p
-n wraps the script with a while(<>) loop and sets each line to $_

To split each line into an array @F use -a
Normally, arguments can be accessed with @ARGV

NB: If using more than one flag, make sure that the 'e' is last!

Comments powered by Disqus

Copyright 2010. All Rights Reserved.