key as filehandle error
From: Bill (fult01_at_yahoo.com)
Date: 09/01/04
- Next message: Pablo S: "mod_perl - dbi - DBD:Pg performance test, old vs new"
- Previous message: Joe Foran: "Help with Script Needed Desperately"
- Next in thread: Joe Smith: "Re: key as filehandle error"
- Reply: Joe Smith: "Re: key as filehandle error"
- Reply: nobull_at_mail.com: "Re: key as filehandle error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Aug 2004 17:04:42 -0700
I'm trying to use a hash key as a filehandle like so.
#!/usr/local/bin/perl
use strict;
my %buf = (
'F00' => 'foo.dat'
);
&open_files();
exit 0;
sub open_files {
while(my($k,$v)=each(%buf)) {
open ($k, ">$v") || die $!;
}
}
But, I get the following error:
Can't use string ("F00") as a symbol ref while "strict refs" in use at
./try.pl line 14.
I've tried varouis things like \*FOO, *$k ... nothing seems to work.
UNLESS I take out strict, then it works.
Anyone know what's happening here.
Thanks,
Bill
- Next message: Pablo S: "mod_perl - dbi - DBD:Pg performance test, old vs new"
- Previous message: Joe Foran: "Help with Script Needed Desperately"
- Next in thread: Joe Smith: "Re: key as filehandle error"
- Reply: Joe Smith: "Re: key as filehandle error"
- Reply: nobull_at_mail.com: "Re: key as filehandle error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|