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