kingjamesid has asked for the wisdom of the Perl Monks concerning the following question:
$a = 'a.txt'; open(IN,$a) || die "cannot open $a for reading: $!"; $b = 'time.txt'; open(OUT,">>$b") || die "cannot create $b: $!"; while (<IN>) { # read a line from file $a into $_ #print OUT $_; if (/returns \d{1} \(in \d{1}.\d{6} secs/) { print OUT ?? ; } } close(IN) || die "can't close $a:$!"; close(OUT) || die "can't close $b:$!";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Print the matched pattern
by johngg (Canon) on Oct 06, 2009 at 17:42 UTC | |
|
Re: Print the matched pattern
by moritz (Cardinal) on Oct 06, 2009 at 16:53 UTC | |
|
Re: Print the matched pattern
by toolic (Bishop) on Oct 06, 2009 at 16:53 UTC | |
|
Re: Print the matched pattern
by bichonfrise74 (Vicar) on Oct 06, 2009 at 16:55 UTC | |
by kingjamesid (Acolyte) on Oct 06, 2009 at 17:00 UTC | |
|
Re: Print the matched pattern
by BioLion (Curate) on Oct 06, 2009 at 16:54 UTC |