s/\|//; s/[|\s]+//g; my $c = 0; s/-/$c++ < 3 ? '-' : ','/eg;