Solved

chomp front of line

Posted on 2007-11-21
1
680 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
ID: 20331079
$line='    some text with whitespace at the beginning';
$line =~ s/^\s+//;
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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…
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…

816 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

10 Experts available now in Live!

Get 1:1 Help Now