Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Command line argument

by krujos (Curate)
on Jun 03, 2002 at 13:10 UTC ( #171217=note: print w/ replies, xml ) Need Help??


in reply to Command line argument

you could just check for it before.

#!/usr/bin/perl $argument = $ARVG[0] || warn "No argument"; print "argv = |$ARVG[0]|\n"; if ($argument !=~/\w/ ) { print "enter an argument \n"; chomp ($argument = <STDIN>); }

.... or something like that. in the reg ex you could even check for the right type of input.

update
thanks to tadman for pointing out this, but I was missing an equals sign in the above.. also, got a cup of coffee in me and fixed other silly stuff.. sorry for the first poor response.


Comment on Re: Command line argument
Download Code
Re^2: Command line argument
by tadman (Prior) on Jun 03, 2002 at 13:13 UTC
    Say what? That's the same as this:
    $argument = undef; while (0) { }
    This is the noise you'll be making when you try and run that program: "ARVG! ARVG!"

    Remember, when pushing buttons on the keyboard, it is important to hit them in the right order. Must be one of those late nights/early mornings?

    I think what you meant was:
    $|++; my $argument = $ARGV[0] || warn "No argument given\n"; do { print "Enter an argument: "; chomp ($argument = <STDIN>); } while (!length($argument));

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (12)
As of 2014-08-20 15:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (116 votes), past polls