The first argument to open is suppose to be filehandle, not the name of the file you want to open. Try this instead:
use strict; use warnings; my @file = qw(foo bar baz); for (@file) { open FH, "path/to/file/$_"; print while <FH>; close FH; }
UPDATE: Those aren't dynamic file handles, by the way. You are just storing the names of the files you want to open in an array, that's all.
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re: Dynamic File Handles
by jeffa
in thread Dynamic File Handles
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |