Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^5: check parameters

by hdb (Parson)
on Apr 08, 2013 at 14:41 UTC ( #1027524=note: print w/ replies, xml ) Need Help??


in reply to Re^4: check parameters
in thread check parameters

ag4ve, can you pls state what you want to achieve? Here is what happens step-wise:

my $pattern ="(".join('|', @{$opts->{params}}).")"; # pattern is now "(a|b)" my @test = grep { /^$pattern/i } keys %$format; # @test = ( "bar", "abc" )

!grep... puts grep into scalar context, ie it will return 2, the length of @test above. !2 is false therefore your "if" block will not be executed.


Comment on Re^5: check parameters
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2014-08-01 15:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (27 votes), past polls