in reply to Re: Perl's Bad Ideas
in thread Perl's Bad Ideas

>Oh. So you're saying that there is no way to store a filehandle in a variable then. (Or at
To which I say, you are getting what you ask for. If you want the contents of $x twice use the x operator.

> but hey, if you say it's "obvious"...
Please note I said *seemed* obvious. As in I was running through a thought process and then comparing against perl's actual behavior.

>This function works just fine, printing to stdout, until one day you forget and open a
>filehandle named X in some completely separate part of the program, and then suddenly
This is not the same, it is not a scalar filehandle.

UPDATE: This is a read-only value, clearly perl could be smart-enough to recognize that read-only values which are not STDERR, STDIN, or STDOUT as not a filehandle.

perl -e '$a= \"a"; ${$a}.="s"; print ${$a}' Modification of a read-only value attempted at -e line 1.

--
perl -pe "s/\b;([st])/'\1/mg"

Replies are listed 'Best First'.
Re: Perl's Bad Ideas
by Dominus (Parson) on Apr 07, 2002 at 00:56 UTC