How Perl Saved my Day
Previous First Next

Notes

  1. On some operating systems (e.g., UNIX), you can make a script executable. The operating system then uses the first line in the script to find the interpreter. On other operating systems (like MS-Windows), the Perl interpreter has to be called explicitely, and the script is given as a command line parameter to Perl, e.g., c:\perl myscript.pl. On the Mac, it's a different story again. It is always a good idea to include this line, even on operating systems that cannot execute scripts directly. back
  2. The syntax for the Perl function print is
    print FILEHANDLE LIST
    and prints a string or comma separated list of strings to the file designated by FILEHANDLE. If FILEHANDLE is omitted, then the function prints to the currently selected output filehandle, initially STDOUT
    [Note 4]. back
  3. $_ is a Global Special Variable. It's the default input and pattern matching space, and assumed by Perl in several places, even if you don't specify it. back
  4. STDOUT is a Global Special Filehandle. The others are: ARGV, STDERR, STDIN, DATA, and _. back
  5. A hash is a data type that contains key-value pairs, e.g.
    $myHash{"TCP"} = "Transmission Control Protocol";
    $myHash{"IP"} = "Internet Protocol";
    Note the curly braces {}. The variable name prefix for the whole hash is %, used, e.g., when initializing the hash to an empty list
    %myHash = ()
    while the variable name prefix when accessing a single element is $.
    back

Previous First Next
10.12.1998 Michael Gfeller