foreach my $elem (@test_array) { open(IN, $0) || die "No file: $!\n"; while( defined(my $line = ) ) { } close IN; }