|
|
| Don't ask to ask, just ask | |
| PerlMonks |
Re^3: Toggling vars in each iterationby Athanasius (Vicar) |
| on Jan 17, 2013 at 02:41 UTC ( #1013684=note: print w/ replies, xml ) | Need Help?? |
|
Hello akki_best, and welcome to the Monastery! $var1 = $var2; $var2 = $var1; That won’t work, because by the time you get to the second command, the value of $var1 has already been overwritten by the first command. But in Perl, swapping these values is as simple as:
P.S. Please format your code using <code> tags. See Markup in the Monastery. Hope that helps,
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||