Type detection: Difference between revisions

m
(Added Perl example)
Line 344:
 
$fmt = "%-11s is type: %s\n";
printf $fmt, '$scalar', detectref(\$scalar);
printf $fmt, '@array', detectref(\@array);
printf $fmt, '%hash', detectref(\%hash);
printf $fmt, '$regex', detectref( $regex);
printf $fmt, '$reference', detectref(\$reference);
printf $fmt, '$subref', detectref( $subref);</lang>
sub greet { print "Hello world!" };
printf $fmt, '$subref', detect( $subref);</lang>
{{out}}
<pre>$scalar is type: SCALAR
2,392

edits