http://www.perlmonks.org?node_id=15030


in reply to Get chatbox lines

there's no need to use splice in a void context to trim the cache in your getnewlines sub. just use the following code:
my $CACHE_LIMIT = 50; $#$cache = $CACHE_LIMIT - (1 - $[);

Replies are listed 'Best First'.
RE: RE: Get chatbox lines
by ZZamboni (Curate) on May 26, 2000 at 21:43 UTC
RE: RE: Get chatbox lines
by ZZamboni (Curate) on May 30, 2000 at 23:31 UTC
    The problem with this (now that I have tested it well) is that it enlarges the array when it is originally smaller than the limit. splice doesn't do that. Any ideas? Thanks,

    --ZZamboni

      not besides just appending 'if @$cache > $CACHE_LIMIT';