perl - How do I get access to filehandle and format respectively by typeglob? -


enter image description here

it seems filehandle , format doesn't have prefix,so can't reference them tricks %{*spud}.

is there i'm missing?

update

how access format? why $fd=*stdout , $fd=\*stdout both work?

update2

code:

package foo; our $spud = 'a scalar'; our @spud = 'an array'; our %spud = (a => 'hash'); sub spud {} format spud = . open 'spud', $0;   $stash = \%foo::; $name  = 'spud'; $glob  = $$stash{$name};  $type (qw(scalar array hash code io format)) {     #this works     #print *$glob{$type}, $/;      #this doesn't work,only output 1 row of scalar                                       print *{$foo::{spud}}{$type}, $/;  } 

output:

[root@perl]# perl tb scalar(0xa4dcf30)      [root@perl]#  

{package foo;     our $spud = 'a scalar';     our @spud = 'an array';     our %spud = (a => 'hash');     sub spud {}     format spud = .     open 'spud', $0; }  $stash = \%foo::; $name  = 'spud'; $glob  = $$stash{$name};  $type (qw(scalar array hash code io format)) {      print *$glob{$type}, $/; } 

prints:

 scalar(0x810070) array(0x81c750) hash(0x81bb00) code(0x81bbd0) io::handle=io(0x81b670) format(0x81bc40) 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -