cheekuperl has asked for the wisdom of the Perl Monks concerning the following question:
I was wondering about the possible return values of the ref function until I came across the list in ref.
I also verified that the 11 return values are printed using the following code.
Secondly, I have always come across the statement
Perl has three basic types : scalars, arrays, hashes
However, I have not found a definitive for this in perldocs (I was trying to find a list like there was one for 11 possible return types of ref function).
Could anyone elaborate why the return values of ref can't be called as data types in Perl?
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);
Secondly, I have always come across the statement
Perl has three basic types : scalars, arrays, hashes
However, I have not found a definitive for this in perldocs (I was trying to find a list like there was one for 11 possible return types of ref function).
Could anyone elaborate why the return values of ref can't be called as data types in Perl?
Back to
Seekers of Perl Wisdom