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

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007326]
help
Chatterbox?
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
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (167 votes), past polls