in reply to Re: Multiple assignment in Perl
in thread Multiple assignment in Perl

That is embarrassing for me! It was the first thing I tried; it did not work for me at the time. I must have made a typo, etc. Thank you.

Replies are listed 'Best First'.
Re^3: Multiple assignment in Perl
by tobyink (Canon) on Jul 23, 2018 at 04:34 UTC

    Maybe on your first attempt, you put an extra my in front of it? That would cause issues because it would declare two new variables within the while loop which would mask the old variables.

    Also, $a and $b are really bad variable names to choose in Perl. There are special variables with these names used by sort so using them for other stuff can occasionally cause issues. $x and $y would be fine, as would more meaningful variable names.

      Thanks for the tip on variable usage.