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

Re: Array Filter and Lookahead

by thundergnat (Deacon)
on Nov 20, 2012 at 17:25 UTC ( #1004760=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @test = (
        "text text text 1 text",
    ...
    my @filtered = map {/(\d+)(?:\.0*)?\D*$/; $1} @test;
    
    print join "\n", @filtered;
    
  2. or download this
    my @filtered = map {/(\d+(?:\.\d*)?)\D*$/; 0 + $1 || ''} @test;
    
    print join "\n", @filtered;
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2014-09-23 09:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (216 votes), past polls