On Tuesday, May 21, 2002, at 06:16 , Tor Hildrum wrote:
> You can use the $ARGV[X] values directly like above, or you can put them > in > variables. I guess that's what drieux did. Everything passed from the > command line are put into to the @ARGV array. > So, when I write > % ./argv.pl 2 3 bananas apples > @ARGV looks like this: qw(2 3 bananas apples) Right as Rain..... But to go for Taylor's question and pull up my 'plot' in all of this..... Let's assume that 90% of the time I am gronging file foo and I need to stuff it as bar. I would probably do use vars qw/$prog $infile $outfile ..../; BEGIN { # set my default values up at the top here $prog = 'dateAppend'; # what name I will whine as being.... # I wanted to be called KlorthoTheMagnificient # but management couldn't corrolate that. # Files need to be fully qualified filename paths. # since we may not be in either directory when invoked. $infile = "/where/We/got/input.File/foo"; $outfile = "/where/We/Update/Output/files/here.cool/bar"; ..... } # no user servicableParts below here # how we go about parsing them if we had them setCmdLineArgs() if (@ARGV) ; # hence if it were merely -h or --help # we barf the Usage() and bail... #RealCodeStuffHere------ it's the 10% of the time where I want to do dateAppend /someOtherFile - | more that my experience brings me to want to keep the option open to do command line parsing of data.... otherwise dateAppend just winds up in say a crontab file like 0 3 * * * cd /myHappyPlace ; dateAppend NOW I remember why I avoid: print "\twe see $_\n" while<>; perl Reader.pl 1 2 3 hello and welcom to command line args Can't open 1: No such file or directory at Reader.pl line 11. Can't open 2: No such file or directory at Reader.pl line 11. Can't open 3: No such file or directory at Reader.pl line 11. the line after setting command line args [jeeves:/tmp/drieux] drieux% the Majik is tied to the cmdline arguments being files.... and I always forget that and get bit in the butt like the above error case - so stopped that once I first got through Getopt::Std to Getopt::Long.... ciao drieux --- "if you build it, you will have to maintain it, and someone will have enhancement requests for it... Just Plan On it." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]