On Wed, Jan 30, 2002 at 09:37:28AM -0800, John W. Krahn wrote:
> Stefan Kredler wrote:
> > ---8<----
> >     if ( $raw[3] eq ""){
> >       while ( ($key, $value) = each %table ) {
> >         if ($raw[2] =~ /$key/) {
> >           $raw[3] = $value ;
> >           last;
> >         }
> >       }
> >     }
> > ----8<----
> 
> You don't need a while loop for this:
> 
> if ( $raw[3] eq '' ) {
>     $raw[3] = $table{ $raw[2] };
>     }

He might have; your code and his have slightly different meanings.

The key is in how $raw[2] is matched against $key; in his, $key is used as a
regular expression, in yours it's exact.  Granted, he may not have intended
it to be used as a regex, but then again he may have.

 
Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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

Reply via email to