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

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.

Replies are listed 'Best First'.
Re^4: Multiple assignment in Perl
by rnaeye (Friar) on Jul 24, 2018 at 13:05 UTC
    Thanks for the tip on variable usage.