in reply to Scanning a file for a match, printing different part of the line when found.

Maybe it's time to start learning instead of just "finding code"?
use strict; use warnings; my $file = 'search.txt'; open my $fh, $file or die $!; while (<$fh>) { print "$1\n" if /Name:\s*(.*)/; }
  • Comment on Re: Scanning a file for a match, printing different part of the line when found.
  • Download Code

Replies are listed 'Best First'.
Re^2: Scanning a file for a match, printing different part of the line when found.
by cheech (Beadle) on Mar 26, 2011 at 19:42 UTC
    Thanks wind