Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: •Re: Re: •Re: Checking for single digit

by crouchingpenguin (Priest)
on May 06, 2003 at 03:45 UTC ( [id://255794]=note: print w/replies, xml ) Need Help??


in reply to •Re: Re: •Re: Checking for single digit
in thread Checking for single digit

Wouldn't this be more versatile (chomp or no chomp)?

while(defined(my $line = <STDIN>)){ print $1,"\n" if( $line =~ m/\W?(\d)\W?/ ); }

Update As Enlil pointed out, {1} is implied by \d... I guess I more or less meant it to color the fact it was only one digit hungry.

YA update Ok, i will try to actually read before posting next time. As Cody Pendant pointed out, the intent seems to be only these characters, not CONTAINS these characters.


cp
----
"Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic."

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-18 04:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found