November 1999
Beginner
456 pages
10h 18m
English
The debugger isn't the only feature of the Perl interpreter that can be activated by command-line switches. In fact, many useful Perl programs can be written just at the command prompt.
Note
Macintosh users should run these command-line examples from the Script menu by selecting 1-liners and then typing the command in the dialog box.
The key to such programs is the -e switch given to Perl on the command line. Following the -e can be any Perl statements at all, as in this example:
C:\> perl -e "print 'Hello, world';"
Hello, worldYou can use multiple -e statements to insert multiple statements or separate them with semicolons, as shown here:
C:\> perl -e "print 'Hello, world';" -e "print 'Howzit goin?'"Read now
Unlock full access