Syntactic Confectionery Delight | |
PerlMonks |
Re: sorting a file by a date:"YYYY-MM-DD" field with cmpby ikegami (Patriarch) |
on Jun 16, 2015 at 17:45 UTC ( [id://1130653]=note: print w/replies, xml ) | Need Help?? |
In scalar context, the match operator and thus the bind operator returns whether a match was found or not. You want to evaluate the match in list context to get it to return the list of matches. Fix:
Also:
Note: Will break if you get
For a reliable but slower solution, you can use
As for the blank lines, just remove them first using
Update: Added to my answer.
In Section
Seekers of Perl Wisdom
|
|