I did:
print "$scans[0]";
and nothing is printed...where 192.168.1.1 SHOULD be printed...
here's what I have:
open (LOGFILE, $log_file) || die ("Could not open $log_file: $!");
my @array;
while (<LOGFILE>) {
      chomp;
      push (@array, $_)
      if m/ida/i;
}
my $last_host = "192.168.1.1";
my @scans;
while (<LOGFILE>) {
      push (@scans, $_)
      if m/$last_host/i;
}
close(LOGFILE);
print "$scans[0]";



On Fri, 10 Aug 2001 10:28:23 -0400 (EDT)
"Brett W. McCoy" <[EMAIL PROTECTED]> wrote:

> On Fri, 10 Aug 2001, Tyler Longren wrote:
> 
> > I try to show the number of elements in the array like so:
> > print "$#scans";
> 
> That actually gives the index of the last element, not the actual count
> of elements.  You want:
> 
> print scalar(@scans);
> 
> > But that prints "-1".  I know for a fact there are at least 2 entries
> in
> > LOGFILE that have an IP of 192.168.1.1.
> 
> Did you dump the array to see if they are actually in there?
> 
> -- Brett
>                                  http://www.chapelperilous.net/btfwk/
> ------------------------------------------------------------------------
> Your conscience never stops you from doing anything.  It just stops you
> from enjoying it.
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to