[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 390
  • 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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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