what is the difference with this?
grep(/$a/, @b);
&
grep $a eq $_, @b; 

perl is amazing


----- Original Message ----- 
From: "John W. Krahn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 18, 2002 10:39 AM
Subject: Re: question in list


> Alex Cheung Tin Ka wrote:
> > 
> >     I have a problem about the list value.
> >     I have got a scalar say $a='a' and a list say @b = ('a', 'b','c');
> >     how can I check whether $a is one of the value in @b. Is there any
> > easy way to do it and I got lost in perl.com's piles of documentation.
> 
> 
> if ( grep $a eq $_, @b ) { ... }
> 
> 
> use Quantum::Superpositions;
> if ( $a eq any( @b ) { ...  }
> 
> 
> John
> -- 
> use Perl;
> program
> fulfillment
> 
> -- 
> 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