Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: foreach/map equivalency

by wog (Curate)
on Nov 10, 2001 at 21:48 UTC ( #124577=note: print w/replies, xml ) Need Help??


in reply to foreach/map equivalency

To return no value from a map, you're probably going to need to explictly return a null list, ():

my @map = map { $_->{'username'} eq $cgi->param('username') ? $_ : () } @{%{$x +ml}->{'user'}};

However this is better written with grep:

my @grep = grep { $_->{'username'} eq $cgi->param('username') } @{%{$x +ml}->{'user'}};

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2022-12-06 20:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?