Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: String/Numeric Manipulation

by superfrink (Curate)
on Oct 07, 2004 at 18:52 UTC ( #397400=note: print w/replies, xml ) Need Help??


in reply to String/Numeric Manipulation

I tend to be lazy and just cast to an int when I want one. You could use a matching regex instead though.
#!/usr/bin/perl use strict; my $days; do { print "Enter a positive, non-zero integer ('q' to quit).\n> "; $days = <STDIN>; my $num = int $days; if($num > 0) { print "good '$num'\n"; } else { print "'$num' is not > 0\n"; } } while(! ($days =~ m/^q/) );

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (1)
As of 2022-01-25 17:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (67 votes). Check out past polls.

    Notices?