in reply to Dynamic File Handles
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)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dynamic File Handles
by Anonymous Monk on Jun 06, 2005 at 20:34 UTC | |
by cmeyer (Pilgrim) on Jun 06, 2005 at 20:54 UTC |