Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: compare stdin for a number

by tachyon (Chancellor)
on Mar 12, 2004 at 22:05 UTC ( [id://336278]=note: print w/replies, xml ) Need Help??


in reply to compare stdin for a number

Command line switches are handy for some tasks, like -l and -n, which let you write the whole thing in one rather short line:

C:\>perl -lne "print m/^\d{5}$/ ? ' OK' : ' Fail'" 5 Fail 12345 OK 123 Fail Hello Fail 3.141 Fail ^Z

cheers

tachyon

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-24 17:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found