Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Regular Expressions

by toolic (Chancellor)
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 perusing the Monastery: (7)
As of 2014-09-03 04:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (35 votes), past polls