in reply to Re: typeglob: $var = *x ???
in thread typeglob: $var = *x ???
Thanks. So, I have to dereference the variable I assigned the typeglob to in order to turn it back into a typeglob? For instance,
$val = *x; print "@{ *{ $val } }";
Based on the output here:
print $val; --output:-- *main::x
...it's not obvious that $val needs dereferencing.
All three also work if $var = \*x;.
But I did $var = *x, which is not the same:
$what = *x; print $what, "\n"; $what = \*x; print $what, "\n"; *main::x GLOB(0x10082ad88)
It seems like in the first case, I wouldn't have to dereference $what into a typeglob, where I would expect to do so in the second case.
Also, why can I do this:
$fh = *STDOUT; print $fh 'hello', "\n"; --output:-- hello
...and not this:
$STDOUT = 10; $fh = *STDOUT; print ($fh + 2); --output:-- 2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: typeglob: $var = *x ???
by ikegami (Patriarch) on Jun 16, 2011 at 02:34 UTC | |
by 7stud (Deacon) on Jun 16, 2011 at 08:23 UTC | |
by ikegami (Patriarch) on Jun 16, 2011 at 15:30 UTC |