Solved

What does this perl code do? : perl -nle '/(\S+\.C)\W*$/ and print \$1'

Posted on 2011-09-30
2
358 Views
Last Modified: 2012-05-12
Can someone please explain verbosely what the following perl code does?

perl -nle '/(\S+\.C)\W*$/ and print \$1'
0
Comment
Question by:Phazz
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 36890446
It prints the scalar reference address of the first captured match whenever the standard input has a line containing nonblank characters followed by a dot, followed by a C, not followed by any word characers

It would make more sense without the \ in front of the $1
0
 

Author Comment

by:Phazz
ID: 36890471
Aha!

It is used for filtering the output from a g++ compliation of a C++ project, so that only lines ending on ".C" are output.

Thanks!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

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

12 Experts available now in Live!

Get 1:1 Help Now