Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Getting args

by monk2b (Pilgrim)
on Dec 11, 2001 at 05:04 UTC ( [id://130828]=note: print w/replies, xml ) Need Help??


in reply to Re: Getting args
in thread Getting args

I hope this helps
#!/usr/local/bin/perl -w use strict; my $d; shift = $d;

I hate posting after such experience monks,but
I think this is what you are after
learning too monk2b
update I was very backwards in the original post
I hope I did not do anyone permanent harm my apologies.
Thanks davorg

Replies are listed 'Best First'.
Re: Re: Re: Getting args
by davorg (Chancellor) on Dec 11, 2001 at 14:09 UTC

    I think you may be a little confused.

    $ARGV[0]=$d;

    This overwrites the first command line argument with the value of $d - which is undefined.

    shift=$d;

    This doesn't even compile.

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

      I was a lot confused
      #!/usr/local/bin/perl -w use strict; my $d; $d = shift; #this wiill work print "$d\n"; #will print argument

      OR
      #!/usr/local/bin/perl -w use strict; die "argument required\n" unless defined $ARGV[0]; # will stop the scr +ipt if there is no argument print "This is what I ment $ARGV[0]\n";

      I screwed that one up good. This is better and tested
      learning too monk2b

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-25 15:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found