in reply to Displaying a Image based on date range
opendir my $dh, "path/images" or die $!; my $min = '2005-04-05'; my $max = '2005-05-05'; my $found = ''; for my $file ( grep !/^\./, readdir $dh ) { unless ( $file =~ /^((\d){4}\-(\d){2}-(\d){2}\.jpg)$/ ){ warn "Rejected filename $file"; next; if ( ( $file le $max ) and ( $file ge $min ) and ( $file gt $found + ) ) { $found = $file; } } closedir $dh; print "$found\n";
One world, one people
|
|---|