my $seen; for my $file (@list){ # Do whatever testing you want here print "\n" if $seen++; print "Testing file: $file\nPassed: $p\nFailed: $f" }