in reply to $1 $2 Weirdness?

This substitution:
$name=~s/(\w)(\s)(\w)/$1/eig;
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/\s.*//; # replace space and all following characters wit +h empty string
And you better read up on your regex qualifiers -- the "eig" at the end of that substitution is completely unnecessary:

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
    Thanks graff for pointing out the error of my ways. BTW, I know what the "e", "i" and "g" qualifiers are, but thanks anyways.