On Fri, Jul 16, 2004 at 08:46:32AM -0400, arichmond(contr-ird) wrote: > I have been playing with ipblocker from ipblocker.org and modified it to > take a list of attackers from an IDS. I wanted to do some error checking > to pull out the "already blocked ip's" before sending it to the original > script. I can't figure out why the delete $hash{'$x'} won't work in my > script. Can someone tell why? > > 'query.outsidescanners.result': file contains > (2 row affected) > 1.1.1.1 > 3.3.3.3 > > > #!/usr/bin/perl -w > use diagnostics; > use strict; > our $dir='/usr/local/apache/ipblocker'; > our $file='query.outsidescanners.result'; > our @nodes=(); > our ($line)=0; > our %hash=(); > open (BLK, "$dir/$file") or die "Cannot open file: $!"; > foreach $line(<BLK>){
chomp $line; > if ($line =~/.*row.*/i){ > }else{ > $hash{$line}="new"; > }} > close(BLK); > our $a='3.3.3.3'; > delete ($hash{$a}); > print keys %hash; also, s/our/my/ unless you have a good reason not to. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>