Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://742815]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2024-04-19 16:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found