I'd probably not load up all the files into an array - there might be a lot of them someday, and it's easy to check if a file exists.
So, in pseudocode (since you're asking for approach), something like:
That should get you on the write path. perldoc Date::Calc for the exact syntact for Add_Delta_Days.use Date::Calc; # For date math my $day = some formatting to localtime... return if $day > $end_date; while ( $day > $start_date ) { # you'll have to either keep these in Y +YYYMMDD format, or do some more complicated comparison logic my $hopeful_filename = "images/$today"; if (-e $hopeful_filename) { return $hopeful_filename; } $day = Add_Delta_Days(...); # Subtract one from the day }
-- Kirby, WhitePages.com
In reply to Re: Displaying a Image based on date range
by kirbyk
in thread Displaying a Image based on date range
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |