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
In reply to Re^2: typeglob: $var = *x ???
by 7stud
in thread typeglob: $var = *x ???
by 7stud
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |