Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: need an array ref from grep

by orderamidchaos (Initiate)
on May 29, 2013 at 00:41 UTC ( [id://1035754]=note: print w/replies, xml ) Need Help??


in reply to need an array ref from grep

I know this is super old at this point, but for anyone else who references such things in their searches, here's another (IMHO cleaner) way to write greps...

my $arr_ref = [ grep {/[[:alpha:]]/} keys(%h) ];

You can also assign the result to a dereferenced variable:

my $arr_ref; @$arr_ref = grep {/[[:alpha:]]/} keys(%h);

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 22:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found