The search patterns I am looking for are contained inside the list (each
element of the list is going to be used to scan an entire log file). So
"if ( /match/ )" needs to reference each element of the FOREACH loop
which I will have nested inside a while <FILENAME> loop. That's what's
confusing me.

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Tore Aursand
Posted At: Wednesday, November 05, 2003 5:12 AM
Posted To: Perl
Conversation: Regex search using scalar
Subject: Re: Regex search using scalar

On Tue, 04 Nov 2003 20:41:17 -0800, Paul Harwood wrote:
> I would like to enumerate a list and search through each element like
> so:
> [...]

Why do you want to enumerate the list?  Do you _really_ need to know the
index of the current element?  If really so:

  my $i = 0;
  foreach ( @list ) {
      $i++;
      if ( /match/ ) {
          # ...
      }
  }

> If (/$logs[i]/)

Please post _real_ Perl code.  The code above has no meaning and won't
even compile.


-- 
Tore Aursand <[EMAIL PROTECTED]>


-- 
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