- or download this
(from perl --help)
- or download this
-e, -p, -n,-l, -0,-a, -F, -M
- or download this
perl -e '$date=localtime(time); print $date;'
- or download this
perl -e "$date=localtime(time); print $date;"
- or download this
perl -e '$date=localtime(time); print $date,"\n";'
- or download this
perl -l -e '$date=localtime(time); print $date;'
- or download this
while(<>) { }
- or download this
perl -l -n -e 'print $1 if /(\w+ear)/' some.txt
- or download this
perl -l -n -e 'BEGIN{$sum=0;} $sum=$sum+ $1 if /(\d+)/;print $1; END {
+print "Total: ",$sum}'
- or download this
while(<>) { print ; }
- or download this
perl -l -p -e 's/Microsoft/Micro\$\$\$oft/g' some.txt
- or download this
perl -l -n -e 'BEGIN{open (OUT,/path/to/file || die } print if /^.*\w
+{2,}.*$/gm; END {close (OUT); }'
- or download this
split;
- or download this
perl -l -a -n -e 'print $F[5]' some.txt
- or download this
perl -l -a -F: -n -e 'print $F[0]' /etc/passwd
- or download this
perl -012 -e ...
- or download this
-00 ( paragraph mode) -0777 (slurp mode)
- or download this
-M like use Module;
-m is like use Module();
- or download this
use Wallace(gromit);
$saveTheDay=gromit(data);
- or download this
$saveTheDay=Wallace::gromit(data);
- or download this
perl -l -MNet::Telnet -e'print $Net::Telnet::VERSION'
- or download this
perl -MLWP::Simple -e '$content = get("http://www.perlmonks.org/")
+;print $content'