Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Formatting STDIN for date format

by roboticus (Chancellor)
on Sep 18, 2013 at 11:07 UTC ( #1054637=note: print w/ replies, xml ) Need Help??


in reply to Formatting STDIN for date format

AshleyJordan:

You can't format STDIN, you can only look at what came in and see if it matches what you want. You can do it something like this:

# Get a line from the user (or file if redirected) my $line = <STDIN>; while ($line !~ /regex to check input/) { # input didn't match regex, so tell the user and get another line +of data print "Sorry, I don't understand that, please enter the date like: + DD-MM-YYYY\n"; $line = <STDIN>; } ... code that uses properly formatted date ...

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2016-08-27 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (382 votes). Check out past polls.