Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: returning scalar context from map or grep

by robartes (Priest)
on Apr 28, 2003 at 13:08 UTC ( [id://253668]=note: print w/replies, xml ) Need Help??


in reply to returning scalar context from map or grep

Do you mean something like:
my @ary=qw/dog cat gnat/; my $first=(grep {/at$/} @ary)[0]; print $first; __END__ cat

CU
Robartes-

Replies are listed 'Best First'.
Re: Re: returning scalar context from map or grep
by !unlike (Beadle) on Apr 28, 2003 at 13:14 UTC

    AAAARRRRGGGG!!!!!

    I tried every method I knew apart from that one!

    Thanks Robartes, it worked a treat! ;)

    !unlike

    I write my Perl code like how I like my sex: fast and dirty. ;)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-23 12:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found