Ted Fines wrote:
> Hi,

Hello,

> I'm running into a Cach-22 with 'use strict', and filehandles.
> 
> I have a program which opens two log files at the beginning:
> open(INFLOG,">>$info_log") || die "Could not append to $info_log_file.  
> Quitting.\n";
> open(ERRLOG,">>$error_log") || die "Could not append to $error_log_file.  
> Quitting.\n";
> 
> Then throughout the program, different subroutines print to the log files, 
> e.g.
> in code sample A below, ERRLOG and INFLOG are declared at the start.  A
> subroutine tries to pass 'ERRLOG' or 'INFLOG' to the 'log' subroutine as a
> parameter.  With 'strict refs' in use, this code generates this error:
> L:\>test.pl
> Bareword "ERRLOG" not allowed while "strict subs" in use at L:\test.pl line 
> 22.
> Execution of L:\test.pl aborted due to compilation errors.
> 
> OK.  I've tried a few things to work around this, but no matter what I've 
> tried
> I just get an error that I can't do something with strict something-else (refs
> or subs) is in use.
> 
> If I turn off strict it all just works, of course.  Would someone please share
> how to solve this problem, while using the 'strict' directive?

perldoc -q "How do I pass filehandles between subroutines"

perldoc -q "How can I use a filehandle indirectly"



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to