|Welcome to the Monastery|
sorting a file by a date:"YYYY-MM-DD" field with cmpby jason.printer (Initiate)
|on Jun 16, 2015 at 17:31 UTC||Need Help??|
jason.printer has asked for the wisdom of the Perl Monks concerning the following question:
Hello-- I have solved my problem, but I don't know how. (I have kept it below for ...posterity?) What's going on here? :) When I change my sort function to the following it works as expected, sorting the dates. What is the difference between parentheses absent and parentheses present?
I am newish to Perl and trying to sort a file but it is behaving unexpectedly. I have a file which has several items in json format (not in date order and with some blank lines), for example:
when I run my code intended to sort by date, it seems to sort the file in another way which I don't quite understand. It puts all the blank lines first, and then all the other lines stay in the order they were in the file. Here is my code:
Any help would be appreciated. I am new to custom sorts and regex.