in reply to Unexpected deletion of data using > operator
hmm .. it also looks like you're keeping track of the array indexes that you want to whack, then setting those array values to undef, then skipping over the undefs when you ouptut it. This can all be done natively w/ a simple grep.
And can even collapse it further:
my @customerarray = ( ... ); my $now = time; my @keep = grep { my ($timestamp) = (split '::', $_)[2]; $now - $timestamp <= 15*24*60*60 # items less than 15 days old } @customerarray; open FH, '>', "$cuslist.tmp" or die "Can't open $cuslist.tmp: $!"; print FH "$_\n" for @keep; close FH;
And can even collapse it further:
open FH, '>', "$cuslist.tmp" or die "Can't open $cuslist.tmp: $!"; print FH "$_\n" for grep { time - split '::', $_)[2] <= 15*24*60*60 } +@customerarray; close FH;
In Section
Seekers of Perl Wisdom