in reply to Here document syntax, what is $0 (was: Newbie need a clue)

The "EOUsage" is the terminator for what's referred to as a here document. Note the print STDERR <<EOUsage; line several lines above it. Basically, everything between that line and the terminator gets printed to STDERR. Try perldoc perldata for more info, search for the words "here document".

The quoted text seems lucid to me. Perhaps I can rephrase a little ? If this script exists on a unix box as /usr/local/bin/myscript, $0 could contain one of several values, depending on how it was called:

How script was startedContents of $0
$ myscriptmyscript
$ /opt/local/bin/myscript/opt/local/bin/myscript
$ cd /opt/local/bin;./myscript./myscript

The following bit: $0 =~ s#.*/##; is a regex that strips everything from the front of $0 until it reaches the last "/" character. So, if the script is named myscript, after this regex is run against $0, $0 would contain myscript, regardless of how it was called.