What am I doing wrong?!

From: Tony Walker (tony.walker_at_dhl.com)
Date: 10/29/03


Date: 29 Oct 2003 08:36:05 -0800

Hi Guys,

OK, what I'm doing is a basic search of a logfile for specific
strings. At present I have this working fine by manually creating an
array and foreaching it..
However, I now want to read these strings from a file and perform the
same actions as before but I'm hitting a problem. I slurp the file
into and array and it only ever finds ONE of the strings in the file,
not the other!!

Any help much appreciated..

Tony

p.s this is my first attempt at perl so it may not look great...
##
#!/opt/perl/bin/perl
open (ER,"ALL_errors") or die "$!";
my @entry = <ER>;

open (LOG,"all.log") or die "$!";
while (<LOG>){
my $CUR=$_;
for (my $i=0;$i<=$#entry;$i++) {
        my $LINE = @entry[$i];
        if ($CUR =~/$LINE/){
        print $CUR;
        }
}
}
####



Relevant Pages

  • Re: K&R2 Secition 5.9 - major blunders
    ... Each element of b doesn't point to a 20 element array of int. ... This mistake is crucial because ... my explanation is really the qualities of something else: ... > The use of the array of pointers is to store the strings. ...
    (comp.lang.c)
  • Re: K&R2 Secition 5.9 - major blunders
    ... Each element of b doesn't point to a 20 element array of int. ... This mistake is crucial because ... my explanation is really the qualities of something else: ... > The use of the array of pointers is to store the strings. ...
    (comp.lang.c)
  • Re: Returning array of strings through callback from unmanaged to
    ... Is the array of strings a jagged array or fixed length array? ... It is imperative that I am able to return the array of strings from the ... I have control over how many strings I want the unmanaged code to return ... What I want to accomplish is to pass a callback function to unmanaged ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: attempting to return values from array from w/in a function
    ... What I get is an array w/ only the most recent array entry. ... I am new to PHP & do not have formal scripting ... you end up comparing strings, but the test you mean probably is simply: ... case 1: {codeblock} ...
    (comp.lang.php)
  • Re: sorting and shuffling array
    ... > I need some help with sorting and shuffling array of strings. ... qsort() library function. ...
    (comp.lang.c)