my @fifo; my $MAX_FIFO = 53; #max size is optional sub add_entry { die "Cicular buffer overflow\n" if (@fifo >= $MAX_FIFO); my $entry = shift; #well, $_[0] is ok for syntax too #but I think this is more clear #these simple assignment statements are # not "expensive" push @fifo, $entry; } sub get_entry { return (shift @fifo); }