Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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


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 ...


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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2016-10-22 08:25 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (294 votes). Check out past polls.