in reply to How to read the regular expression from another file?
You can run this little script like this:my @pattern = <STDIN>; # slurp patterns chomp @pattern; # remove end-of-line my $pattern = join '|', @pattern; # create regexp open F2, "<file2" or die "Cannot open file: $!\n": while (<F2>) { # read DATA print if /$pattern/; } close F2;
$ ./myscript.pl <file1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to read the regular expression from another file?
by MidLifeXis (Monsignor) on May 07, 2015 at 12:25 UTC | |
|
Re^2: How to read the regular expression from another file?
by sumathigokul (Acolyte) on May 07, 2015 at 10:13 UTC |