perl - How to understand the output of Data::Dumper? -
#!/usr/bin/perl use data::dumper; use tk; use strict; use warnings; $name='test'; $s_ref=\$name; bless $s_ref, 'tk'; print dumper \$s_ref; the output info is:
$var1 = \bless( do{\(my $o = 'test')}, 'tk' ); how understand info? output?
data::dumper needs reference string without creating new variable in current scope, presumably how it. working middle outwards have my $o = 'test' declares $o, sets it's value 'test' , returns $o. do{} block in case provides scope my binding exist in, when block exits $o ceases exist value references continues to, \ @ start of block takes reference it's returned value. reference string 'test' blessed 'tk'.
Comments
Post a Comment