Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: (jeffa) Re: vandale.pl (with Getopt::Declare)

by danger (Priest)
on Mar 30, 2002 at 21:51 UTC ( #155503=note: print w/replies, xml ) Need Help??


in reply to (jeffa) Re: vandale.pl (with Getopt::Declare)
in thread vandale.pl

In the interest of tmtowtdi, here's an alternate Getopt::Declare scenario that sets up the $all and @words variables in action blocks. Here I decided to make the search words required (but without option description), and just allow for -a as an abbrev. of -all (instead of using the --all version):

#!/usr/bin/perl -w use strict; use LWP::UserAgent; use Getopt::Declare; use vars qw/$all @words/; my $opts = Getopt::Declare->new(<<'EOS'); -a[ll] List all matches {$all = 1} <terms:s>... [required] {@words = @terms} EOS for my $word (@words) { # insert fetch code ... # ... last unless $all; } __END__

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2016-10-01 19:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (6 votes). Check out past polls.