Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2016-10-22 03:24 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (291 votes). Check out past polls.