Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 393
  • Last Modified:

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

Can someone please explain verbosely what the following perl code does?

perl -nle '/(\S+\.C)\W*$/ and print \$1'
0
Phazz
Asked:
Phazz
1 Solution
 
ozoCommented:
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
 
PhazzAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now