Subroutine
sub by_lastname { my @a = split /\s/, $a; my @b = split /\s/, $b; return $a[1] cmp $b[1] || $a[0] cmp $b[0]; }
This can be inefficient on large amounts of data
Multiple splits on each @a and @b