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

Re: Reading command line flags into variables...?

by t0mas (Priest)
on Feb 01, 2001 at 11:05 UTC ( [id://55663]=note: print w/replies, xml ) Need Help??


in reply to Reading command line flags into variables...?

One option is to use the built in -s flag when you run perl. From perldoc perlrun
-s enables rudimentary switch parsing for switches on the comman +d line after the program name but before any filename arguments (or +before a --). Any switch found there is removed from @ARGV and sets +the corresponding variable in the Perl program. The following pro +gram prints "1" if the program is invoked with a -xyz switch, and +"abc" if it is invoked with -xyz=abc. #!/usr/bin/perl -s if ($xyz) { print "$xyz\n" }


/brother t0mas

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-18 19:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found