in reply to Re: Question about eval
in thread Question about eval

Because of TIMTOWDI (there's more than one way to do it). Attempting to print something somewhere is perfectly fine, even on a closed filehandle. But then, you should check the return value of print as it tells you wether the print actually succeeded. If you "use warnings" perl will warn you:
use warnings; my $junkprint = print JUNK "foo"; my $stdoutprint = print STDOUT "junkprint = '$junkprint'\n"; print "stdoutprint = '$stdoutprint'\n"; __END__ Name "main::JUNK" used only once: possible typo at - line 2. print() on unopened filehandle JUNK at - line 2. Use of uninitialized value in concatenation (.) or string at - line 3. junkprint = '' stdoutprint = '1'

Read the eval, do, require and use entries in perlfunc, as well as perlfaq8 which contains the difference between do, require and use. Then there is Super Search.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}