cheekuperl has asked for the wisdom of the Perl Monks concerning the following question:
However, I could not get the vstringRef to print VSTRING. Any clues why #11 above shows SCALAR?format = . sub fun { print "\nThis is fun"; } $packRef={}; bless $packRef,"NONSENSE"; $scalarRef=\$_; #1 $arrRef=\@ARGV; #2 $hashRef=\%ENV; #3 $codeRef=\&fun; #4 $refRef=\$scalarRef; #5 $globRef=\*STDIN; #6 $lvalueRef=\ substr ("learning perl",0,4); #7 $regexpRef= qr/something/; #8 $formatRef= *STDOUT{FORMAT};#9 $ioRef= *STDOUT{IO}; #10 $vstringRef= \v5.10.10; #11 print "\n1. scalarref is ". ref($scalarRef); print "\n2. arrRef is ". ref($arrRef); print "\n3. hashRef is ". ref($hashRef); print "\n4. codeRef is ". ref($codeRef); print "\n5. refRef is ". ref($refRef); print "\n6. globRef is ". ref($globRef); print "\n7. lvalueRef is ". ref($lvalueRef); print "\n8. regexpRef is ". ref($regexpRef); print "\n9. formatRef is ". ref($formatRef); print "\n10. ioRef is ". ref($ioRef); print "\n11. vstringRef is ". ref($vstringRef); #prints SCALAR print "\n12. packRef is ". ref($packRef);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question about Perl refs and basic types
by tobyink (Canon) on Jul 18, 2012 at 15:29 UTC | |
|
Re: Question about Perl refs and basic types
by RedElk (Hermit) on Jul 18, 2012 at 18:20 UTC | |
by cheekuperl (Monk) on Jul 18, 2012 at 21:24 UTC | |
|
Re: Question about Perl refs and basic types
by Anonymous Monk on Jul 19, 2012 at 00:35 UTC | |
by cheekuperl (Monk) on Jul 19, 2012 at 03:04 UTC | |
|
Re: Question about Perl refs and basic types
by locked_user sundialsvc4 (Abbot) on Jul 18, 2012 at 15:24 UTC | |
by cheekuperl (Monk) on Jul 18, 2012 at 15:41 UTC | |
by Anonymous Monk on Jul 19, 2012 at 00:36 UTC |