use strict; use SlidingList::Changes qw(find_new_elements); my $filename = 'log.txt'; tie @log, 'Tie::File', $filename or die "Couldn't tie to $filename : $!\n"; # See what has happened my @status = get_last_20_status_messages(); # Find out what we did not already communicate my (@new) = find_new_elements(\@log,\@status); print "New log messages : $_\n" for (@new); # And update our log with what we have seen push @log, @new;