tie @LOG, 'Tie::File', '/etc/logfile'; sub log { push @LOG, @_; my $overflow = @LOG - 100; splice @LOG, 0, $overflow if $overflow > 0; }