I want to swap two variables values without using the third variable in Perl, e. g.:
my $first = 10; my $second = 20;
Please suggest me how
$first = $first + $second; $second = $first - $second; $first = $first-$second;
This will swap two integer variables A better solution might be
$first = $first xor $second; $second = $first xor $second; $first = $first xor $second;