Type detection: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) (Added Perl example) |
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: typos) |
||
Line 344: | Line 344: | ||
$fmt = "%-11s is type: %s\n"; |
$fmt = "%-11s is type: %s\n"; |
||
printf $fmt, '$scalar', |
printf $fmt, '$scalar', ref(\$scalar); |
||
printf $fmt, '@array', |
printf $fmt, '@array', ref(\@array); |
||
printf $fmt, '%hash', |
printf $fmt, '%hash', ref(\%hash); |
||
printf $fmt, '$regex', |
printf $fmt, '$regex', ref( $regex); |
||
printf $fmt, '$reference', |
printf $fmt, '$reference', ref(\$reference); |
||
⚫ | |||
sub greet { print "Hello world!" }; |
|||
⚫ | |||
{{out}} |
{{out}} |
||
<pre>$scalar is type: SCALAR |
<pre>$scalar is type: SCALAR |