foreach my $file (@ARGV) { open (FILE, "<", $file) || die "could not open '$file': $!"; while () { print $_; } print "whatever you wanted to use as a separator $file\n"; }