Not exactly answering your question maybe…
…but since your time string is perfect for pulling the time comparison into the domain of string comparison…
use strict; use warnings; chomp(my @directories_time_tagged = <DATA>); for my $directory_name ( @directories_time_tagged ) { next unless $directory_name =~ /(\d\d\d\d_\d\d_\d\d_\d\d)/; # Year_ +month_day_hour my $date_time = $1; my ($year, $month, $day, $hour) = split /_/, $date_time; my ($y_now, $m_now, $d_now, $h_now) = (localtime)[5,4,3,2]; my $now = sprintf('%d_%02d_%02d_%02d', $y_now+1900, $m_now+1, $d_now +, $h_now); if ($date_time le $now ) { # If the date has been passed print "\nconditions have been met for $directory_name\n"; } } __DATA__ foo_2006_03_02_14_verzeichnis bar_2007_05_02_02_directory baz_2007_05_03_22_dossier
In reply to Re: Appropriately assigning times to variables
by pKai
in thread Appropriately assigning times to variables
by Win
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |