How to sort dates in Perl ?



How to sort dates in Perl ?..

Answer / kiruthikau

Try the following way.
Example
-------
use Data::Dumper;
my @dates = ( "02/11/2009" , "20/12/2001" , "21/11/2010" ) ;
@dates = sort { join( '', (split '/', $a)[2,1,0] ) cmp
join( '', (split '/', $b)[2,1,0]) } @dates;
print Dumper \@dates;

Is This Answer Correct ?    7 Yes 0 No

Post New Answer

More CGI Perl Interview Questions

What are prefix dereferencer?

0 Answers  


Explain about typeglobs?

0 Answers  


Write a program to download the contents from www.perlinterview.com/answers.php website in Perl.

0 Answers  


How do you debug a Perl scripting ( at the compile time error or run time error) in Unix environment ?

4 Answers  


What is the use of command “use strict”?

0 Answers  






What is perl shift array function?

0 Answers  


How do I pass a command line argument in perl?

0 Answers  


In Perl, there are some arguments that are used frequently. What are that arguments and what do they mean?

0 Answers  


Why does Perl not have overloaded functions?

0 Answers  


what is Chop & Chomp function does?

0 Answers  


When do you use perl programming?

0 Answers  


What does delete function do in perl?

0 Answers  


Categories