in reply to Command lines Args and STDIN
As for switches to your script - perl doesn't differentiate between switches and files, all command line arguments show up in @ARGV, which are taken as files to be opened and read in sequence, if you use <> - you have to process command line switches yourself, and remove switches and switch arguments from @ARGV. There are modules for that task - I recommend Getopt::Std or Getopt::Long.
Regarding <STDIN> or <>, see perlop:
The null filehandle <> is special: it can be used to emulate the behavior of sed and awk. Input from <> comes either from standard input, or from each file listed on the command line. Here's how it works: the first time <> is evaluated, the @ARGV array is checked, and if it is empty, $ARGV[0] is set to "-", which when opened gives you standard input. The @ARGV array is then processed as a list of filenames.so <> operates on STDIN only if the array @ARGV is empty.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|