in reply to Problem with File Handler
It guessed an unquoted string. You then opened, bareword filehandle. What you've stored in @filez would probably suffice if you weren't using strictures, but with strictures on, you are informed that you're using a symbolic reference, which is considered illegal, and the script dies. (Updated)
You then print to the filehandle stored in $file. But $file holds a string, not a filehandle.
You probably want something like this:
my @files = \( *FILE1, *FILE2 ); open FILE1, ">$path1" or die $!; open FILE2, ">$path2" or die $!; foreach my $file ( @files ) { print $file "Some data\n"; }
Dave
|
|---|