[Israel.pm] How to "split" but keep the delimiter
gaal at forum2.org
Mon Dec 6 03:45:25 PST 2004
On Mon, Dec 06, 2004 at 12:48:58PM +0200, Yossi.Itzkovich at ecitele.com wrote:
> I know I can do it without "split", but still, by using split, how can I
> still leave the delimiter in the returned list ?
> For example:
> my @out=split (/instance No \d+/ , $text)
> I want to iterate over @out, but still having that \d in place
Use a positive lookahead assertion.
my $out = split /(?=instance No \d+)/, $text;
Gaal Yahas <gaal at forum2.org>
More information about the Perl