[Gllug] Regexp

Alain Williams addw at phcomp.co.uk
Thu Mar 7 15:37:05 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$/
> 
> blah blah
> 
> This would be very handy if its possible. 

Errr how do you want the separate elements of the array to be separated ?
Spaces, comma, nothing .... ?

How about

$namelist = join ':', @name;
if/^$namelist/

Or do you want to do something completely different ?

-- 
Alain Williams

#include <std_disclaimer.h>

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




More information about the GLLUG mailing list