in reply to Clean Code - What a mess...

  1. You have a variable @global. This is a bad thing. Name it something useful.
  2. You do an insert explicating $writer[0] through $writer[24]. join would make this cleaner.
  3. qw is your friend. For example,
    @snort =("large","packet","bad","traffic","inbound","attempt","web", +"IIS","cmd.exe","cgi","access","multiple","decode");
    becomes
    @snort = qw(large packet bad traffic inbound attempt web IIS cmd.exe cgi access multiple decode);
  4. You should die after you cannot connect to the database.
  5. Use multi-dimensional arrays, or, better, hashes of arrays. That way, your use of @watcher doesn't require split. Something like
    my @watcher = ( \@pix, \@denies); ... my @global = @{$watcher[$i]};
  6. Where do you use $global? (Using warnings would've caught this...)
  7. if($global[$x]=~/ZSP/i){ @ret=split(/ZSP/,$global[$x]); $global[$x]=""; $global[$x]=join(' ',@ret); }
    should be (before using references correctly...)
    if (my @ret = split /ZSP/, $global[$x]) { $global[$x] = join ' ', @ret; }
  8. Something like the following might help ...
    foreach my $r (@spy) { if($input =~ /$r/i){ $findings .= ' ' . $r; $fn++; } }
And, there's plenty more where that came from. The most important thing I can say is that your data structures drive your logic, especially in an application like this. Improve your understanding of data structures and your code will be that much easier. Every hour you spend on learning and mastering data structures will translate to a week saved in coding, if you code seriously for a year. That's not an exagerration, either.

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.