Missing Something.

David Precious davidp at preshweb.co.uk
Mon Oct 1 16:28:25 BST 2007


Clooney, David wrote:
> Can someone point out if I am missing something, I don't seem to be able
> to match a  variable with an element of an array, 


>     @crxfnp02_users = <EMACRXFNP02>;
[...]
>     if         ($crxfnp02_users =~ m/$chester_userid /i ) {
> 

I'm assuming that @crxfnp02_users contains one username per line of the
file, and you want to see if $chester_userid is in there somewhere.

For matching elements of an array, grep is your friend :)

http://perldoc.perl.org/functions/grep.html


As Nigel said, using "use strict" would have immediately caught the
glaring problem (using $crxfnp02_users which was never defined).






More information about the london.pm mailing list