Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Removing spaces, again.by larryl (Monk) |
on Mar 16, 2001 at 01:40 UTC ( [id://64794]=note: print w/replies, xml ) | Need Help?? |
Your pattern is doing a greedy match, so (.*) matches everything from "LCD" to the end, including trailing whitespace. The regex is still happy because the \s*$ at the end is satisfied by matching nothing. Try m/^\s*(\S*)/ instead. No need to add the optional whitespace match at the end of the pattern as long as you know you only want to match up to (but not including) the first (optional) whitespace.
In Section
Seekers of Perl Wisdom
|
|