On Jul 4, 2005, at 19:25, Mads N. Vestergaard wrote:

My string is "<tag>foo</tag>test test test<tag>bar</tag>test test
test<tag>baz</tag>test test test".

What I would like to have is to get foo,bar,baz into an array, I've
tried to substitute it, but it doesn't seem to work for me. Either I get foo correct and nothing else, or I get baz correct without anything else.

The natural idiom there is m//g in list context:

    my @tags = $string =~ m!<tag>(.*?)</tag>!g;

-- fxn


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to