Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Answer: How can I strip an arbitary number of leading spaces from a string?

by Zombie parsec (Initiate)
on Sep 25, 2000 at 20:14 UTC ( #33921=categorized answer: print w/replies, xml ) Need Help??

Q&A > strings > How can I strip an arbitary number of leading spaces from a string? - Answer contributed by Zombie parsec

OK, silly me, that didn't take very long to figure out:
$string = <>; $string =~ s/ *//;

Edit by Corion
This answer is maybe sufficient, if every string contains at least one space. If one of your strings does not contain a space, it will remove spaces from the middle or the end of the string. Please have a look at chromatics post for a correct answer.

  • Comment on Answer: How can I strip an arbitary number of leading spaces from a string?
  • Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2016-12-05 21:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (94 votes). Check out past polls.