in reply to Changing the order of elements in the variable

A note on this section of code:

($a, $b) = split(',', $author[$i]);

It is often recommended not to use $a and $b, as they are special-cased in some functions within perl (sort, for example). You could get some funky results if you collide with one of these cases. "Better" names might be $lastName and $firstNameAndInitial or $partBeforeComma and $partAfterComma.

You could also trim off the space along with the comma with: split(',\s+', ...), but then you need to also adjust your assignment in the next line.

--MidLifeXis