% perl $a = 'this is a test'; $a =~ s/[^i[:space:]]/-/g; print $a,$/; #### --i- i- - ----