----- Original Message ----- From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]> To: "Leon" <[EMAIL PROTECTED]>
> >(Q2) How to do the following :- > > If there are 2 spaces, I wish to convert it into 1   like > >this =>  > > 3 spaces into 2   like this =>    > > 4 spaces into 3   like this =>     > > I would do something like this: > > s/ ( +)/' ' x length($1)/g; > > That matches a space and then one or more spaces and stores the "one or > more" part in $1. The length of $1 is 1 less than the number of spaces > found. Many Thanks to Jeff, Gordon, Bompa & Members. Jeff solution seems to fit what I want, however the expression s/ ( +)/' ' x length($1)/g; print the substitution text ==> x length( ) <== instead of its values. Example below:- @a = ("this is 1 space => \n", "this is 2 space => \n", "this is 3 space => \n", "this is 4 space => \n"); $a = join '',@a; $a =~s/ ( +)/' ' x length($1)/g; print $a; #results this is 1 space => this is 2 space =>' ' x length( ) this is 3 space =>' ' x length( ) this is 4 space =>' ' x length( ) # what must I do to this regex # $a =~s/ ( +)/' ' x length($1)/g; # so that I could get the undermentioned results this is 1 space => this is 2 space => this is 3 space => this is 4 space => Thanks. _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]