use strict; use warnings; my $file1Str = <; close $fileIn; for my $secFile ($file2Str, $file3Str) { open my $secIn, '<', \$secFile; print "Sec: $_" for <$secIn>; } #### Prim: Alex 3 44 Prim: Barry 2 44 Prim: James 6 45 Prim: Drew 9 43 Prim: Alex 124 175 Sec: James 1 22 Sec: Alex 89 120 Sec: Alex 134 155 Sec: Barry 12 24 Sec: Alex 154 174 Sec: James 29 45 Sec: Drew 19 54 Sec: Drew 139 154