[Mastering-perl] First Peek: Tied Variables

brian d foy brian.d.foy at gmail.com
Thu Feb 9 13:31:15 EST 2006


On 2/9/06, Yitzchak Scott-Thoennes <sthoenna at efn.org> wrote:

> >     my $fh = \do{ no warnings; local *FH };
> >     my $object = tie *{$fh}, $class, $output_file;

> > I added a paragraph at the end of that secction showing this and
> > telling people not to do it. :)

> I'm not sure why "no warnings" is better than "use Symbol" :)
> but I'd just do:

>  my $fh = \do { local *FH; *FH };

Yeah, that's a good way too. I wouldn't want to "use Symbol" unless I
stick that close to the declaration. I don't want code spread out all
over the program just for this little thing which I'm telling people
not to do anyway. :)


--
brian d foy <brian.d.foy at gmail.com>
http://www.pair.com/~comdog/


More information about the Mastering-perl mailing list