Amoe has asked for the wisdom of the Perl Monks concerning the following question:
The string to match is the argument to the -s switch, by the way.use strict; use warnings; use Getopt::Std; my %switches; getopts('s:', \%switches); my @array = qw(the quick fox jumped over the lazy dog); ITEM: foreach my $item (@array) { my $seen; if ($switches{s}) { ($seen = $switches{s} eq $item) if (!$seen); next ITEM if (!$seen); } print "$item\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Ovid) Re: skipping until an alement is matched
by Ovid (Cardinal) on Nov 01, 2001 at 23:53 UTC | |
|
Re: skipping until an element is matched
by Vavoom (Scribe) on Nov 01, 2001 at 23:54 UTC | |
|
Re: skipping until an alement is matched
by dvergin (Monsignor) on Nov 02, 2001 at 10:42 UTC | |
|
Re: skipping until an alement is matched
by Purdy (Hermit) on Nov 01, 2001 at 23:49 UTC |