Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Regexp Epiphany

by Aristotle (Chancellor)
on Aug 22, 2004 at 17:56 UTC ( [id://384957]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Regexp Epiphany
in thread Regex Epiphany

How can it? You lose information. That strings contains nothing else that would indicate whether the times are AM or PM. Date::Manip is probably assuming 24-hour-time, effectively assuming AM for all times.

Did you actually test your assumption or are you simply programming by coincidence?

$ perl -MDate::Manip -le'print UnixDate "Wed, 28 Jul 2004 9:12 PM", "% +s"' 1091041920 $ perl -MDate::Manip -le'print UnixDate "Wed, 28 Jul 2004 9:12", "%s"' 1090998720

You didn't notice that, because you're not asking for the time, only for the date. Are you sure you will never want to see the time, in a future change to the script? Will you remember this idiosyncracy of your solution at the time? You should at least document this issue in your script; the better approach would of course be to either strip the entire time out of the string completely (Date::Manip will assume 12AM sharp) or not to destroy this information in the first place.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re^4: Regexp Epiphany
by Sigmund (Pilgrim) on Aug 23, 2004 at 09:20 UTC
    but i don't mind at all...
    my files will be like this:

    sender040822.html

    and the date isn't an important issue.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-10-03 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (42 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.