More complicated lists may be constructed: |
($a, @fred) = @fred; # sets $a to first element of @fred and then removes this first element from @fred |
($a,$b,$c) = (1,2,3); # sets $a=1, $b=2, $c=3 |
Curiously, setting a scalar equal to an array returns the length of the array |
$a = @fred; # returns $a as length of @fred |
The function length returns the number of characters in a string |
$a = length (@fred); # returns length in characters of first entry in @fred |
($a) = @fred; # sets $a to be first entry of @fred |