#!/usr/bin/perl -w use strict; use Fatal qw(open close); # so I don't have to bother testing them my @files= @ARGV; my %marker= map { $_ => 0 } @files; while( keys %marker) { foreach my $file (@files) { if( exists $marker{$file}) { open( my $fh, '<', $file); seek( $fh, $marker{$file}, 0); # the 0 means 'set the new position in bytes to' $marker{$file} if( defined( my $line=<$fh>)) { print $line; $marker{$file}= tell $fh; } else { delete $marker{$file}; } close $fh; } } }