Without commenting on (or even understanding!) the rest of the code, my ears perked up on this:
/^"\s*(.*)\s*"\s*,\s*"\s*(.*@.*)\s*"\s*$/;
$nomes[$. - 1]=$1;
$mail[$. - 1]=$2;
$nomes[$. - 1]=~s/\\(.)/$1/g;
Never use $1 except in the context of knowing that you had a successful match. If the match fails, you'll get a stale $1, and that could ruin your day.
In this case, if the match should never fail, add an "or die" to the match line.
| [reply] [d/l] |
As has been pointed out, if you only need one derangement, it's better to simply
shuffle the array (as you're doing - FY) and then simply rotate the copy.
We're building the house of the future together.
| [reply] |