in reply to $1 $2 Weirdness?
is only removing the space and the first character of the second word. What you want instead is something like this (note that capturing parens are not needed):$name=~s/(\w)(\s)(\w)/$1/eig;
And you better read up on your regex qualifiers -- the "eig" at the end of that substitution is completely unnecessary:$name =~ s/\s.*//; # replace space and all following characters wit +h empty string
update: forgot to mention, the first substitution could be a lot simpler as well -- again, no capturing parens needed:
$temp =~ s/\s/+ +/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: $1 $2 Weirdness?
by apt_get (Acolyte) on Jun 27, 2005 at 00:16 UTC |