Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 wandering the Monastery: (3)
As of 2016-02-09 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?





    Results (297 votes), past polls