in reply to Use of foreach
I have outlined my problem in the comments of the code. It is a slightly perplexing problem. Am I misunderstanding how the foreach loop works?# print @file_names; exit; # This prints out the full array content +s when enabled foreach (@file_names){ print $_; exit; # this gives me the error message: Use of uninitia +lized value in print
You're either missing some relevant parts of your program, and thus you're doing wrong because we always recommend to prepare minimal but complete examples still exhibiting the problem or you're cheating. with my perl:
C:\temp>perl -wle "$a[4]=5;print @a" Use of uninitialized value in print at -e line 1. Use of uninitialized value in print at -e line 1. Use of uninitialized value in print at -e line 1. Use of uninitialized value in print at -e line 1. 5
If the entries of @file_names are all defined first, then for some reason the first one becomes undef, that's a whole 'nother thing, and your problem.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |