# note the lower-casing inline ($fus = lc $fus) =~ s/\W+/_/g; #all spans of 1 or more non-words become 1 '_' $fus =~ s/^_|_$//g; #at most one on each end, because of the above