Help for this page

Select Code to Download


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