in reply to Re^3: push to an array lines matching a pattern, and the lines before and after the matching
in thread push to an array lines matching a pattern, and the lines before and after the matching

thanks for the ack suggestion, but it is slower than the "pure perl" implementation when using anchors or \b,\s etc
sub sub6 { #perl ack my $p = $_[0]; #pattern my $mR = $_[1]; #more rows my @values; my $time = [gettimeofday]; my @valori = qx (ack -C $mR "$p" textMatchInAfile.txt) or die "system @values` failed: $?"; say 'number of values found with ack' . $#valori; say 'time sub6 ack' . tv_interval($time); }
  • Comment on Re^4: push to an array lines matching a pattern, and the lines before and after the matching
  • Download Code