Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

help me please

by Anonymous Monk
on Apr 12, 2002 at 05:47 UTC ( #158492=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

My lecturers in their infinite wisdom have decided to leave out of the textbook how to use command-line options... I need to do the following: specify a file on the command-line to open and use in the script... if anybody can help me, my e-mail is thanx in advance

Comment on help me please
Re: help me please
by Anonymous Monk on Apr 12, 2002 at 05:49 UTC
    it's me again... it seems like my e-mail is on the blink... just post it here... James
Re: help me please
by BUU (Prior) on Apr 12, 2002 at 06:12 UTC
    /me hopes hes not violating any monastery standards.. everything on the command line is automagically placed into the @argv array, split on spaces. moreoever, the diamond operator automagicaly reads from the first arguement in the argv array (or something like that.. go look it up)

      That would actually be the @ARGV array.

      #!/usr/bin/perl -w use strict; my $filename= shift @ARGV; ....

      As BUU mentionned <> works automagically: you can call the following script with perl my_file

      #!/usr/bin/perl -w use strict; while( <>) { # reads from my_file ... }
Re: help me please
by cjf (Parson) on Apr 12, 2002 at 06:22 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://158492]
Approved by jlk
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2015-04-01 09:41 GMT
Find Nodes?
    Voting Booth?

    Who makes your decisions?

    Results (2 votes), past polls