in reply to Re^5: Regular expression match in code
in thread Regular expression match in code

Surprise surprise,
print Dumper \@allServers; print Dumper \@bigArray;
prints nothing; just  $VAR1 = []  print Dumper $var; correctly prints the IP present in the incoming SNMP trap. So my reading from file part is going wrong?! How? Its fairly straight forward and I have even tested it by writing  exit(0); after the read from config (populates @allServers) and write into @bigArray (<ip,server>) format. Help... :(

Replies are listed 'Best First'.
Re^7: Regular expression match in code
by moritz (Cardinal) on May 12, 2010 at 10:08 UTC
    The easist explanation is that your open call fails. Since you don't check the return value, it does that silently.
    open my $fh, '<', $configFile or die "Can't open '$configFile' for reading: $!"; my @allServers; while (<$fh>) { push (@allServers, $_) if /^\w/; } close $fh or warn "Error while closing file: $!";
    Perl 6 - links to (nearly) everything that is Perl 6.