in reply to Sort path strings by component count.

Why use split at all if you only want to count the components? Just count the slashes using tr///, as follows:
@paths = sort { $b =~ tr/\\// <=> $a =~ tr/\\// } @paths;

By the way, <=> will force a scalar context, so scalar is not needed.