in reply to Improve My Code...

Also

while (@dates) { ...... shift(@dates); }

better to write as:

foreach my $date (@dates) { ..... }

Replies are listed 'Best First'.
Re^2: Improve My Code...
by cheech (Beadle) on Aug 09, 2009 at 21:42 UTC
    I initially used foreach(@array){...} instead of while(@array){ ... shift(@array)} but changed it because I was getting booted from the server after a few hundred iterations, and was planning on restarting the loop from the current iteration. As it turned out, the problem was on my end of the connection, so I never needed to implement that and just never went back to foreach. Why though is it superior to while in this case?