ag4ve has asked for the wisdom of the Perl Monks concerning the following question:
EDIT: It seems I haven't defined what should succeed and fail - it should match the first characters in a string. So, In the above example with parameters: abc, bar, fii, and wee,use strict; use warnings; use Pod::Usage; my $format = { abc => 1, bar => 1, fii => 1, wee => 1, }; my $opts; $opts->{params} = ["a", "b"]; if (!grep { /^(join('|', $opts->{params}))/i } keys %$format) { pod2usage( -verbose => 0, -output => \*STDERR, -msg => "$0 bad parameter difinition used [" . join(", ", so +rt {$a cmp $b} @{$opts->{params}}) . "].\n" . "Possible parameters are: " . join(", ", sort {$a cmp $b} keys %$format) . "\n"); } print "1\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: check parameters
by hdb (Monsignor) on Apr 08, 2013 at 14:18 UTC | |
by ag4ve (Monk) on Apr 08, 2013 at 14:26 UTC | |
by tobyink (Canon) on Apr 08, 2013 at 23:36 UTC | |
by ag4ve (Monk) on Apr 08, 2013 at 14:31 UTC | |
by Corion (Patriarch) on Apr 08, 2013 at 14:34 UTC | |
by hdb (Monsignor) on Apr 08, 2013 at 14:41 UTC | |
by ag4ve (Monk) on Apr 08, 2013 at 14:42 UTC | |
by hdb (Monsignor) on Apr 08, 2013 at 14:50 UTC | |
by hdb (Monsignor) on Apr 08, 2013 at 16:16 UTC | |
|
Re: check parameters
by blue_cowdawg (Monsignor) on Apr 08, 2013 at 14:13 UTC | |
by ag4ve (Monk) on Apr 08, 2013 at 14:22 UTC | |
by blue_cowdawg (Monsignor) on Apr 08, 2013 at 14:49 UTC |