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 are the two ways to get private values inside a subroutine or block?

913


How to open and read data files with Perl

1027


Is there any way to add two arrays together?

954


You want to download the contents of a url with perl. How would you do that?

864


What does Perl do if you try to exploit the execve(2) race involving setuid scripts?

928


Explain lists ?

915


How can I implement the function overloading in Perl ? I read about the operator overloading, I do not know how to implement the function overloading. Thanks in advance ?

2889


What is the difference between use and require in perl?

839


Write syntax to use grep function?

950


How does polymorphism work in perl?

904


What are perl strings?

876


Write the program to process a list of numbers.

965


What are perl array functions?

1078


How to dereference a reference?

963


In CPAN module, name an instance you use.

943