Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to sort dates in Perl ?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is stdin in perl?

924


Write a program that shows the distinction between child and parent process?

896


How to get help for perl?

949


Why does Perl not have overloaded functions?

992


What is the use of -w, -t and strict in Perl?

956


How to determine strings length in perl?

921


Explain gmtime() function in perl?

927


How to print escaping characters inside a string in perl?

856


How do I replace every TAB character in a file with a comma?

938


what is the main function of fork() in cgi programming?

1062


How can I display all array element in which each element will display on next line in perl ?

886


What is eval function in perl?

920


How to compare two strings in perl?

902


How to connect to SQL server through Perl?

1002


Which operator in perl is used for the concatenation of two strings?

968