----- Original Message ----- From: "darren chamberlain" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, March 06, 2003 2:42 PM Subject: Re: TT type question (well maybe not)
> * Andy Williams (IMAP HILLWAY) <andy.williams at hillway.com> [2003-03-06 09:05]: > > I've got a text file that contains a whole load of TT tags. > > What I need to do is get all of these tags into an array. > > [-- snip --] > > > I have read the file into a scalar variable (hey, I can so the easy > > bit :), but for the life of me I can't work out a nice simple(ish) way > > of getting the tags into an array. > > You could use Template::Parser directly: > > use Template::Parser; > > $f = my_file_as_a_string(); > $p = Template::Parser->new; > my @array = map { $_->[0] } grep { ref eq "ARRAY" } @{ $p->split_text($f) } > > Kind of hackish, but it works. > Thanks all. Actually went for a combination of all the above so as not to offend anyone :) my @array = map { $_ =~ m/\[\%\s+(\S+)\s+\%\]/g } $copy; Which seems to work. Andy