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

Re^3: Can @ARGV work within Perl functions or is it just for script input?

by jasonk (Parson)
on Feb 10, 2009 at 16:46 UTC ( #742815=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Can @ARGV work within Perl functions or is it just for script input?
in thread Can @ARGV work within Perl functions or is it just for script input?

Even in those cases, there are usually clearer solutions...

use Getopt::Long qw( GetOptionsFromArray ); sub do_awesome_things { GetOptionsFromArray( \@_, 'files=s' => \my @files, 'verbose!' => \my $verbose, ); warn "Going to process files @files. " . "Verbose is ".( $verbose ? 'ON' : 'OFF' ).".\n"; } do_awesome_things -v => -file => 'foo.txt', -file => 'bar.txt';

www.jasonkohles.com
We're not surrounded, we're in a target-rich environment!


Comment on Re^3: Can @ARGV work within Perl functions or is it just for script input?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2015-07-03 16:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (54 votes), past polls