[Gllug] perl and arrays

home at alexhudson.com home at alexhudson.com
Thu Jun 28 20:53:07 UTC 2001


On Thu, Jun 28, 2001 at 08:53:50PM -0400, Will Macdonald wrote:
> I have a quick, and probably simple Perl question.

All Perl questions are simple :-)

> if ($_ !=~ @ignored_entries) {
>                  put in to database;
>                  }
> 
> For some reason using the ! causes a problem. I haven't done any perl in 
> a while but why doesn't this work ?

Because !=~ isn't a comparison operator? You will kick yourself.... 

!~

While I'm at it, don't put commas in qw(), it won't work (at least, it will,
but not in the way you intend - 'perl -w' and 'use strict;', and all will
become clear!). Your if statement won't work either - it looks like you're
evaluating @array in scalar context, which isn't what you want (it gives you
the cardinality of the data). Use map(){} instead, if you can 'require
5.005;' (or is it 5.004? can't remember...). Otherwise, foreach (@array){}
is what you want.

Cheers,

Alex.

-- 

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list