Is there an easier way to swap two values in an array? This works:
$ perl -le '@a=(1,2,3,4) ; ($a[0],$a[1])=($a[1],$a[0]) ; print
join("\t", @a) ; '
2 1 3 4
This doesn't:
$ perl -le '@a=(1,2,3,4) ; $a[0,1]=$a[1,0] ; print join("\t", @a) ; '
1 1 3 4
Regards,
- Robert
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/
