in reply to Scanning a file for a match, printing different part of the line when found.
use strict; use warnings; my $file = 'search.txt'; open my $fh, $file or die $!; while (<$fh>) { print "$1\n" if /Name:\s*(.*)/; }
|
---|
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 |