ykatzin has asked for the wisdom of the Perl Monks concerning the following question:
I’m trying to run the following code:
But I’m getting the following error message:use strict; use Carp; open (File_1,">c:/File1.txt") || die "Can't open File1 for writing\n"; open (File_2,">c:/File1.txt") || die "Can't open File2 for writing\n"; my $variable = 1; my $fileName = "File_".$variable; print $fileName "Hello\n";
Is the a way to use a variable file name with strict refs on??Can't use string ("File_1") as a symbol ref while "strict refs" in use + at….
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Bypassing strict refs
by merlyn (Sage) on Jan 23, 2003 at 17:12 UTC | |
|
Re: Bypassing strict refs
by thezip (Vicar) on Jan 23, 2003 at 18:31 UTC | |
|
Re: Strict refs
by davorg (Chancellor) on Jan 23, 2003 at 17:03 UTC |