CGI Perl Question:
Download Questions PDF

How to sort dates in Perl?


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;

@sortDates = sort { join(\\'\\',(split\\'/\\',$a)[2,1,0] ) <=> join(\\'\\',(split\\'/\\',$b)[2,1,0])} @mydates;

Download CGI Perl Interview Questions And Answers PDF

Previous QuestionNext Question
Packing and Unpacking.

Hi, I want to get output as 0x23400000345....
in the below example How to get?
i tried out, but unable to get the answer

$y=pack(L L,$t,$r);
printf("nThe value is $x1");

I didnt get constant output?
Sort a word "system" in perl/shell without using built in functions output should be emssty?