mr_p has asked for the wisdom of the Perl Monks concerning the following question:
I would like to parse a all occurrence into an Array. Is it possible to do this? The below Is the code I have.
#!/usr/bin/perl my $str = "<item><i>headline 1</i></item> < item><i>headline2</i></item>"; my @x =~ /<(.+?)>.+<\/\1>/ for $str;
Is there a way to get all 'item' into array?
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing with RegEx into Array
by ikegami (Patriarch) on Jun 25, 2010 at 18:03 UTC | |
by mr_p (Scribe) on Jun 25, 2010 at 20:47 UTC | |
by ikegami (Patriarch) on Jun 25, 2010 at 21:35 UTC | |
| |
by mr_p (Scribe) on Jun 25, 2010 at 18:17 UTC | |
by ikegami (Patriarch) on Jun 25, 2010 at 18:31 UTC | |
by JediWizard (Deacon) on Jun 25, 2010 at 18:31 UTC | |
|
Re: Parsing with RegEx into Array
by toolic (Bishop) on Jun 25, 2010 at 18:16 UTC | |
by mr_p (Scribe) on Jun 25, 2010 at 18:27 UTC |