in reply to divide one file into multiple arrays

I'm not entirely sure what's going on, but I note when you do your pattern match, you don't include an operator (usually - you need 'm' for 'match' 's' for substitute, or tr for transliteration). I don't know if that should work or not. How does this work:

if ( m/$site/ ) { print "$_ matched $site\n"; push ( @bad_log, $_ ); }

Replies are listed 'Best First'.
Re^2: divide one file into multiple arrays
by kcott (Archbishop) on Jun 26, 2013 at 03:29 UTC
    "usually - you need 'm' for 'match' ..."

    You don't need it for /pattern/ or 'pattern'. You also don't need it for ?pattern?; however, that construct is deprecated.

    #!/usr/bin/env perl use strict; use warnings; my $x = 'abc'; if ($x =~ /b/) { print "y\n" } else { print "n\n" } if ($x =~ 'b') { print "y\n" } else { print "n\n" } if ($x =~ ?b?) { print "y\n" } else { print "n\n" }

    Output:

    $ junk Use of ?PATTERN? without explicit operator is deprecated at ./junk lin +e 7. y y y

    See perlop - Regexp Quote-Like Operators for details.

    -- Ken