smackdab has asked for the wisdom of the Perl Monks concerning the following question:
my @tmp; my $cur_qty; if (!defined $Output{"host"}) { $cur_qty = 0; } else { @tmp = @{$Output{"host"}}; $cur_qty = @tmp; } if (!$cur_qty) { # No saved data, just assign it $tmp[0] = $data; } elsif ($cur_qty >= 10) { # Remove oldest shift @tmp; # Add newest push @tmp, $data; } else # Just append it { push @tmp, $data; } # Save it $Output{"host"} = \@tmp;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 1: More on: memory usage/leaks
by tilly (Archbishop) on Dec 10, 2001 at 04:08 UTC |