Parag Kalra wrote:
You can try following:

$_ =~ s/^\.(\s)+//g;

You are using capturing parentheses but you are not using the results of that capture anywhere so why use them? You are using capturing parentheses in LIST context so even if there are multiple whitespace characters you are only capturing ONE.

If you are using the parentheses for grouping then it would be more efficient to use non-capturing parentheses instead, but grouping only makes sense if you have a GROUP of characters to match, but you only have ONE.

The use of the /g option is superfluous because the pattern is anchored to the beginning of the string and there is only ONE beginning of string in any string.



John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity.               -- Damian Conway

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to