Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Regular Expressions

by toolic (Bishop)
on Nov 15, 2012 at 01:25 UTC ( #1003910=note: print w/ replies, xml ) Need Help??


in reply to Regular Expressions

I don't think you nedd a nasty regex:

use warnings; use strict; use Scalar::Util qw(looks_like_number); while (<DATA>) { chomp; my $temp = $_; my $unit = lc chop $temp; if (looks_like_number($temp)) { print "temp = $temp : unit = $unit\n"; } } __DATA__ 55F 77c foo +0.4F


Comment on Re: Regular Expressions
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (17)
As of 2015-07-28 13:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls