Ryan10975073 wrote: > > The statement ($a,$b) = ($b ,$a); is swapping without a third variable. > But looking at a lower level , it is storing a temporary variable in the > registers.
No it's not. It's building a temporary list of two values. > How can i get that temporary variable/value from the > registers/memory which will have value of either $a or $b. There is no 'temporary variable'. You are getting confused with what Perl does and how you would write the swap in another language. ($a,$b) = ($b ,$a) does precisely what it says. No more and no less. If it were implemented internally like this $a ^= $b; $b ^= $a; $a ^= $b; then where is the value that you imagine you are looking for? > Would love to see solution on that. Why? You can hold on to a temporary list like this: use strict; use warnings; my ($a, $b, $c, $d); { my $temp = [$b, $a]; ($a, $b) = @$temp; ($c, $d) = @$temp; } but you haven't explained what you're trying to do. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]