Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: how to access the commandline arguments?

by crabbdean (Pilgrim)
on May 01, 2004 at 09:42 UTC ( #349590=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $count = @ARGV;
    print $count;
    
  2. or download this
    if (@ARGV < 3) {
            die "use: script var1 var2 var3\n";
    ...
            my ($var1, $var2, $var3) = @ARGV;
    }
    ## then use $var1, $var2 and $var3 in your program
    
  3. or download this
    my ($stream, $path, $rturn, $depth, $display) = @ARGV;
    $stream = \*STDOUT unless @_ > 0;
    ...
    $rturn = 'all' unless @_ > 2;
    $depth = -1 unless @_ > 3;
    $display = 'rel_file' unless @_ > 4;
    
  4. or download this
    my $nextvar = shift @ARGV;
    
  5. or download this
    for my $this (@ARGV) {
           print "$this\n";
    }
    
  6. or download this
    while (<>) {
               print "$_\n";
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://349590]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2014-12-28 17:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls