1 | More complicatedly we can set constructed lists equal to each other |
2 | ($a, @fred) = @fred; # sets $a to first element of @fred and removes this first element from @fred |
3 | ($a,$b,$c) = (1,2,3); # sets $a=1, $b=2, $c=3 |
4 | Curiously setting a scalar equal to an array returns length of array |
5 | $a = @fred; # returns $a as length of @fred whereas |
6 | The function length returns number of characters in a string |
7 | $a = length (@fred); # returns length in characters of first entry in @fred |
8 | ($a) = @fred; # defines two lists equal to each other but as LHS only has one element, this instruction sets $a to be first entry of @fred |