in reply to How to sort the data in Array which has format MMYY
If you had used warnings or ran your script as perl -w 1041970.pl, Perl would've given you a hint on what goes wrong:
Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. Use of uninitialized value in numeric comparison (<=>) at tmp.pl line +10. APR12 MAR13 APR11 MAR12 FEB13 APR13
Now, the task is to find out why $mon->{$a} might be undef. You could for example do a first simple sanity check:
... use Data::Dumper; exists $mon->{JAN} or die "Couldn't find entry for 'JAN' in " . Dumper $mon;
That should give you a hint on how to proceed.
|
|---|