Deb wrote: > > At 16:10:24, on 07.10.03: > Cracks in my tinfoil beanie allowed Jamie Risk to seep these bits into my brain:, > > I'm a casual PERL programmer at best, and I have a working facsimile of the > > non-working code below. When I run it, I get an error "print() on closed > > filehandle $fh at ./test.pl line [n]". > > > > This is just my first step to being able to pass file handles to my > > sub-routines. What have I missed? > > > > open my $fh, "test" || die $!; > > print $fh "Hello!\n"; > > close $fh; > > Try this (untested): > #The variable $fh is not a filehandlie - you need to assign that: > > my $fh = "somefile"; > > open (FILE, ">$fh test") || die $!; # Open file for writing > while (<FILE>) { ^^^^^^ Trying to read from a filehandle that is opened for writing will not work.
> print FILE "Hello\n"; > } > close (FILE); John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]