@paths = sort { $b =~ tr/\\// <=> $a =~ tr/\\// } @paths;
By the way, <=> will force a scalar context, so scalar is not needed.
In reply to Re: Sort path strings by component count.
by ikegami
in thread Sort path strings by component count.
by superfrink
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |