Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Gotchas/Perl/gotchas.pl
Normal file
12
Task/Gotchas/Perl/gotchas.pl
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
sub array1 { return @{ [ 1, 2, 3 ] } }
|
||||
sub list1 { return qw{ 1 2 3 } }
|
||||
|
||||
# both print '3', but why exactly?
|
||||
say scalar array1();
|
||||
say scalar list1();
|
||||
|
||||
sub array2 { return @{ [ 3, 2, 1 ] } }
|
||||
sub list2 { return qw{ 3 2 1 } }
|
||||
|
||||
say scalar array2(); # prints '3', number of elements in array
|
||||
say scalar list2(); # prints '1', last item in list
|
||||
Loading…
Add table
Add a link
Reference in a new issue