#! /usr/bin/perl -w use CGI qw/:standard/; # first install module Date::Calc use Date::Calc qw(Date_to_Days Add_Delta_Days check_date); #@array=readpipe 'ls 'directory'/'subdirectory'.*html' ; @array=readpipe 'ls ./tmp/*html' ; # we will be sorting later #sort @array; @headings=('Title','Issue Date'); @rows=th(\@headings); foreach $n (@array) { open (HTMLFILE,$n); $issue_date=""; while () { if (m/(.+)<\/TITLE>/i){$title=$1}; # had to change / in the middle? if (m/<o:Description>(.+)<o:Description>/i) {$issue_date=$1}; } close HTMLFILE; #push(@rows, td([$title,$issue_date]) push(@temp_rows,[$title, $issue_date, # in case your date looks like "DD.MM.YYYY" Date_to_Days((split(/\./, $issue_date, 3))[2,1,0]) ]); } for my $i (sort {$a->[2] <=> $b->[2] } @temp_rows) { push(@rows, td([@{$i}[0,1]])); } print table({width=>"100%",border=>"1",bordercolor=>"#d9dae6",cellspacing=>"1",cellpadding=>"1"},Tr({bgcolor=>"#97a5f0"},\@rows));