[Gllug] Regexp

will will at hellacool.co.uk
Thu Mar 7 15:53:26 UTC 2002


On Thu, Mar 07, 2002 at 03:22:17PM -0000, Jackson, Harry wrote:
> Hi all
> 
> I am currently parsing a file using Perl and was wondering if I can use
> Arrays in the regexp. For instance
> 
> @name = ("arr","add");
> 
> if /^@name\s at name$/

I wouldn't have thought this would work.  If queried I think the
value of @name will return the number of elements in the array.  You
would need to do something like:

foreach $name (@names) {
	#each pass sees $name take a different element of @names
}

will.

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




More information about the GLLUG mailing list