Solved

chomp front of line

Posted on 2007-11-21
1
661 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 500 total points
Comment Utility
$line='    some text with whitespace at the beginning';
$line =~ s/^\s+//;
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
wordsWithout 49 79
parentbit challenge 3 51
Perl script to delete older files 6 42
Perl File::Find alternative 1 23
A short article about problems I had with the new location API and permissions in Marshmallow
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now