Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Sorting Dates Issue

by Utilitarian (Vicar)
on Aug 18, 2010 at 15:47 UTC ( [id://855829]=note: print w/replies, xml ) Need Help??


in reply to Sorting Dates Issue

You claim this is your code:
use strict; ... sub compare { $a =~ /(\d{2})\/(\d{2})\/(\d{4})/; $c = $3 . $1 . $2; $b =~ /(\d{2})\/(\d{2})\/(\d{4})/; $c = $3 . $1 . $2; $c <=> $d; }
However there are no default variables $c or $d so your code would not run.

The fact that you assign the two compound numbers to the same variable may be your issue, use warnings; would have noted this.

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-26 04:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found