Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-09-30
2
Medium Priority
?
388 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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

618 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