Awesome. This tip cleared the problem right up; thanks for explaining it! ----- Original Message ----- From: "Steve Grazzini" <[EMAIL PROTECTED]> To: "TeamSolCO" <[EMAIL PROTECTED]> Cc: "Perl Beginners List" <[EMAIL PROTECTED]> Sent: Friday, January 30, 2004 3:26 PM Subject: Re: Can't use global FILEHANDLEs?
: TeamSolCO wrote: : > Now then, I've opened a can of worms by adding "use strict" and : > "use warnings" to the source. Keep in mind that this application : > was running JUST FINE before doing this. I'm only trying to 'modernize' : > this old code. Having started with a couple screen-fulls of resulting : > errors, I'm down to just one: "Can't use an undefined value as a symbol : > reference..." The partucular block that causes this error is: : > : > sub close_fifo { : > close($hndFIFO); : > } : > : > It's related open sub is: : > : > sub open_fifo { : > close_fifo(); : : When you call this the first time, you'll end up doing : : close($hndFIFO = undef); : : And strict won't let you dereference "undef" as a filehandle -- for : historical reasons, filehandles and glob/symbol references are more : equivalent than they should be, and that's why your error message is : complaining about a "symbol reference". : : Now, if you're sure you need to close $hndFIFO before re-opening it, : you could do: : : sub open_fifo { : close($hndFIFO) if defined $hndFIFO; : : But it will get closed automatically when you re-open $hndFIFO, and : I think that should be sufficient. : : -- : Steve : : -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>