Charles K. Clarkson wrote:
JupiterHost.Net <mailto:[EMAIL PROTECTED]> wrote:
: Thanks for catching my misstatement :)
Thanks for finally making one. :)
No I make mistakes all the time, no doubt :)
: #!/usr/bin/perl
:
: use strict;
: use warnings;
:
: open my $file1_fh, '<', 'file1' or die "file1 open failed: $!";
:
: open my $file2_fh, '<', 'file2' or die "file2 open failed: $!";
: my @match_list = <$file2_fh>;
: close $file2_fh;
:
: while(<$file1_fh>) {
: my $line = $_;
: chomp $line;
:
: for my $match_against (@match_list) {
: chomp $match_against;
: print "Got the string\n" if $line =~ m{$match_against}xms;
: }
: }
:
: close $file1_fh;
Yes, this is the option the OP chose in a message up thread
from here.
Gotcha, thats what I get basing my code off theirs without reading the
intention :)
The only thing I would change is the repeated chomping of
the matches.
Tur I do liek the chomp() once you did below, shame on me for not doing
that :)
> On second thought I'll also complain about that
5-space initial indent. :)
That had to be the mail clients, I'm a strict 4 spacer :)
open my $file2_fh, '<', 'file2' or die "file2 open failed: $!";
chomp( my @match_list = <$file2_fh> );
close $file2_fh;
.
.
.
for my $match_against (@match_list) {
print "Got the string\n" if $line =~ m{$match_against}xms;
}
Why the {}xms options on the regex? We aren't messing with $/,
so there shouldn't be any multi-line problems. Is it just a
precaution or is their some other reason?
Christmas*, perhaps? :)
Heheh, no just habit from the "Perl Best Practices" book. (*Excelletn*
book by Damian Conway)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>