Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Removing spaces, again.

by larryl (Scribe)
on Mar 16, 2001 at 01:40 UTC ( #64794=note: print w/ replies, xml ) Need Help??


in reply to Removing spaces, again.

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.


Comment on Re: Removing spaces, again.
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://64794]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2014-07-24 09:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (158 votes), past polls