my @patterns = ( qr/Record contentId\=\"\d+\"/ ); my $final_file = "C:/Users/$sso/Desktop/archer_$searchid.txt"; open(my $final_fh, '>', $final_file) or die "Failed to open $final_file - $!"; open(my $input_fh, '<', $output_file) or die "Failed to open $output_file: $!"; while (<$input_fh>) { foreach my $pattern (@patterns) { print {$final_fh} $pattern, "\n"; } } close $final_fh;
With the following code when printing I get the following output. I am thinking I am doing something wrong with the following in storing regex matches, but not sure.
my @patterns = ( qr/Record contentId\=\"\d+\"/ );
(?-xism:Record contentId\=\"\d+\")
(?-xism:Record contentId\=\"\d+\")
(?-xism:Record contentId\=\"\d+\")
(?-xism:Record contentId\=\"\d+\")
(?-xism:Record contentId\=\"\d+\")
(?-xism:Record contentId\=\"\d+\")
(?-xism:Record contentId\=\"\d+\")
(?-xism:Record contentId\=\"\d+\")
(?-xism:Record contentId\=\"\d+\")
(?-xism:Record contentId\=\"\d+\")
(?-xism:Record contentId\=\"\d+\")
(?-xism:Record contentId\=\"\d+\")
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |