I like this code because it takes out the need for a module. The wider context for the code you have given me is:
my (@priority_numbers_in_order, @directories_to_transport) = Search_di +rectories ($input_directory_C, $node); my $count = 0; for (@directories_to_transport){ my $priority_number = $priority_numbers_in_order[$count]; my $specific_recipient_directory = "$recipient_directory"."$priority +_number"; $dir = $_; opendir(DIR, "$dir") or die $!; my $file_name; while (<DIR>){ $file_name = $_; } my $dir_and_filename = $dir.$file_name; rename "$dir_and_filename", "C:$specific_recipient_directory/$file_n +ame" or warn $!; $count++; } sub Search_directories { my ($input_directory_CC, $node) = @_; my $directory_of_interest = "$input_directory_CC"; opendir (DIRY, "$directory_of_interest") or die "Error opening direc +tory : $!"; my @directories; while ($_ = (readdir DIRY)) { print $_, "\n"; if (-d "$input_directory_CC/$_") { print "This is a dir $_ \n"; if ($_ =~ /\d$/){ print "This directory is a number: $_"; push (@directories, $_); } } } close DIRY; print "\n\&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n".$input_directory_CC.@dire +ctories."\n\n"; for my $dir_num (@directories) { my @direcories_to_transport; print "\nforeach of the direcotories : $dir_num\n"; my $input_dir = $input_directory_CC.$dir_num; print ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>$input_dir"; opendir DIRY, $input_dir or die "Error opening directory $input_ +dir - $!"; my @directories_time_tagged = grep /\d*$/, readdir DIRY; closedir DIRY; 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)/; # Yea +r_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_n +ow, $h_now); if ($date_time le $now ) { # If the date has been passed print "\nconditions have been met for $directory_name\n"; my $directory_to_move = $input_directory_CC.$dir_num..$directory +_name; push (@direcories_to_transport, $directory_to_move); push (@priority_numbers_in_order, $dir_num); } } } return @priority_numbers_in_order, @direcories_to_transport; }
I've not tested it though.

In reply to Re^2: Appropriately assigning times to variables by Win
in thread Appropriately assigning times to variables by Win

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.