Hello.
From a.txt, find if a pattern matches, if matches found, copy the MATCHED pattern into time.txt.
But how can i do that?
PRINT OUT ??
Note: the regex format is correct.
$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:$!";