Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

chomp front of line

Posted on 2007-11-21
1
Medium Priority
?
723 Views
Last Modified: 2012-06-27
Experts,
Is there an easy way (in Perl) to delete the white space at the front of a line?

I have a script  that tells how many spaces something should be indented but I have to cut the white space off the front of the line.  Regular expression matching would be GREAT!

Thanks
0
Comment
Question by:dwcronin
1 Comment
 
LVL 48

Accepted Solution

by:
Tintin earned 2000 total points
ID: 20331079
$line='    some text with whitespace at the beginning';
$line =~ s/^\s+//;
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question