:::::::::::::: example02.txt :::::::::::::: :::::::::::::: example1 :::::::::::::: #! /bin/sh perl -e 'print "hello dolly\n";' # UNIX # perl -e "print qq/hello dolly\n/;" # Windows :::::::::::::: example2 :::::::::::::: #! /bin/sh more emp.first echo # Print a blank line perl -ne 'print;' emp.first # Windows: use double quotes echo # Print a blank line perl -ne 'print if /^Igor/;' emp.first # Windows: use double quotes :::::::::::::: example3 :::::::::::::: #! /bin/sh # Unix date | perl -ne 'print "Today is $_";' # Windows # date /T | perl -ne "print qq/Today is $_/;" :::::::::::::: example4 :::::::::::::: #! /bin/sh perl -ne 'print;' < emp.first perl -ne 'print' emp.first > emp.temp :::::::::::::: example5 :::::::::::::: #! /bin/sh # Unix perl -ne 'print if /Igor;' # Windows: use double quotes perl -ce 'print if /Igor/;' # Windows # perl -ne "print if /Igor;" # Windows: use double quotes # perl -ce "print if /Igor/;" :::::::::::::: example6 :::::::::::::: # This is a comment print "hello"; # And this is a comment :::::::::::::: example7 :::::::::::::: #! /bin/sh cat first.perl perl -c first.perl chmod +x first.perl ./first.perl PATH="$PATH:." first.perl :::::::::::::: example8 :::::::::::::: #! /bin/sh more first.perl perl first.perl :::::::::::::: example9 :::::::::::::: #! /bin/sh pl2bat greetme.pl greetme.bat # ./greetme cat greetme.bat :::::::::::::: first.perl :::::::::::::: #! /usr/bin/perl # Program name: first.perl # My first Perl script print "Hello to you and yours!\n"; :::::::::::::: emp.first :::::::::::::: Igor Chevsky:6/23/83:W:59870:25:35500:2005.50 Nancy Conrad:6/18/88:SE:23556:5:15000:2500 Jon DeLoar:3/28/85:SW:39673:13:22500:12345.75 Archie Main:7/25/90:SW:39673:21:34500:34500.50 Betty Bumble:11/3/89:NE:04530:17:18200:1200.75