Re: Passing file handles to sub-routines ...

2003-07-10 Thread John W. Krahn
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

Re: Passing file handles to sub-routines ...

2003-07-10 Thread deb
Please see correction, below: At 13:14:50, on 07.10.03: Cracks in my tinfoil beanie allowed deb to seep these bits into my brain:, > Try this (untested): > #The variable $fh is not a filehandlie - you need to assign that: > > my $fh = "somefile"; > This line isn't quite right: > open (FILE, ">$f

Re: Passing file handles to sub-routines ...

2003-07-10 Thread deb
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 () { print FILE "Hello\n"; } close (FILE); Some would say you don't need to do the close. Some say you do. I usually

RE: Passing file handles to sub-routines ...

2003-07-10 Thread Bob Showalter
Jamie Risk wrote: > 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-routine

Re: Passing file handles to sub-routines ...

2003-07-10 Thread Rob Dixon
Jamie Risk wrote: > I'm a casual PERL programmer at best The best Perl programmers are the most casual :) > 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