in reply to Can't pass filehandle value

Perhaps you should learn how to open/close/write-to a file, and do a few beginner's tutorial on Perl monks.

use strict; use IO::File; my $var1='test'; my $var2='test2'; my $f = new IO::File "$var1/$var2/blah.conf","w" or die "Can't create +blah"; print $f <<FRED blah blah ... FRED ;
Update: mis-interpreted the <<FRED bit. Ouch.

You code has -
open HANDLE, ">$HANDLE" or die; $HANDLE="$var1/$var2/blah.conf";
You are trying to open a file before you assign the file name? That's probably why your script didn't work in the first place.


I see you have fixed that problem in your original post.

Replies are listed 'Best First'.
Re: Re: Can't pass filehandle value
by skooter (Initiate) on Nov 06, 2003 at 03:05 UTC
    I can't use IO::File.
      Well, in that case you could do this -
      use strict; my $var1='test'; my $var2='test2'; open HANDLE ">$var1/$var2/blah.conf" or die "Can't create blah"; print HANDLE <<FRED blah blah ... FRED ; close HANDLE;