History of Idiom 94 > diff from v21 to v22
Edit summary for version 22 by programming-idioms.org:
[Perl] No literature in code block
[Perl] No literature in code block
↷
Version 21
2016-10-26, 12:10:39
Version 22
2016-10-26, 12:11:03
Idiom #94 Print type of variable
Print the name of the type of x. Explain if it is a static type or dynamic type.
This may not make sense in all languages.
Idiom #94 Print type of variable
Print the name of the type of x. Explain if it is a static type or dynamic type.
This may not make sense in all languages.
Comments bubble
Example:
my $s = "foo";
my @a = (1,2);
my %h = {foo=>1, bar=>2};
my $o = bless {}, 'OBJECT';
print ref($_)||"SCALAR", "\n" for $s, \@a, \%h, $o;
Output:
SCALAR
ARRAY
HASH
OBJECT
Comments bubble
my $s = "foo";
my @a = (1,2);
my %h = {foo=>1, bar=>2};
my $o = bless {}, 'OBJECT';
print ref($_)||"SCALAR", "\n" for $s, \@a, \%h, $o;
Output:
SCALAR
ARRAY
HASH
OBJECT