Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Reg Ex exercise

by grondilu (Pilgrim)
on Dec 05, 2012 at 16:29 UTC ( #1007326=note: print w/ replies, xml ) Need Help??

in reply to Reg Ex exercise

You can put your OR inside your regex:

use strict; use warnings; print "Enter the number to check if it is actually a number: "; while (<STDIN>) { chomp; if (/^(\d+|\d+.\d+|-\d+|-\d+.\d+)$/) { print "Yes, it is a number\n"; } else { print "No, it is not a number\n"; } print "Give another input: "; }

Comment on Re: Reg Ex exercise
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2014-09-21 07:17 GMT
Find Nodes?
    Voting Booth?

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

    Results (167 votes), past polls