in reply to Deleting Oldest Logfiles

What you want to do, I might do this way (with thanks to Illuminatus for the suggested use of "ls -1t"):

chomp( my @Files = `ls -1t $LOGSTR` ); die "No files?" if ! @Files; # Up to 10G while ( logsize() > 10_000_000 ) { my $doomed = pop @Files; warn "DELETE $doomed\n"; unlink "$LOGSTR/$doomed" or warn "Can't unlink '$LOGSTR/$doomed': $!"; sleep 2; } sub logsize { my $LOGSIZE = `du -s $LOGSTR`; $LOGSIZE =~ s{ \A # start of string ( \d+ ) # any number of digits [$1] \s # white space .* # anything \z # end of string }{$1}xms; return $LOGSIZE; }

I haven't tested this, however, so use with caution.