my ($x, $y, $z); ($x, $y, $z) = (2, 3, 7); # nearly the same as $x=2; $y=3; $z=7; ($x, $y) = (8, 1, 5); # ignore 5 ($x, $y, $z) = (3, 4); # $z will be undef
A regular question on job interviews:
How can we swap the values of 2 variables, let say $x and $y?
| Prev | Home (Copyright Gabor Szabo) Perl Training Israel | Next |
| Perl6 Lists and Arrays | Up | Swap two values |