What is this 'EOUsage' in the code below? And what is that funky '$0' variable? I obviously didn't find it too helpful, but here's what the perldoc says about $0:
Contains the name of the file containing the Perl script being executed. On some operating systems assigning to ``$0'' modifies the argument area that the ps(1) program sees. This is more useful as a way of indicating the current program state than it is for hiding the program you're running. (Mnemonic: same as sh and ksh.)
I'm guessing, from the way it looks, it automatically comments out the lines but how exactly does it work? Here's the subroutine code I have questions on, edited for brevity:
sub usage { $0 =~ s#.*/##; print STDERR <<EOUsage; Usage: $0 [options] where options are: [-v ] | [--version ] [more of the same...deleted...deleted...deleted...deleted] [-db <n> ] | [--debug <n> ] [-pm/+pm ] | [--preformat-marker / --nopreformat-marker ] More complete explanations of these options can be found in comments near the beginning of the script. EOUsage # [-T <t>:<r> ] | [--tag <tagname>:<regexp> ] }
Any other insights into what this subroutine is doing is much appreciated. Thanks!
2001-03-29 Edit by Corion : Changed title
In reply to Here document syntax, what is $0 (was: Newbie need a clue) by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |