Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I would like to make use of the string that was matched by the regex in the split code line since the numeric will be changing. Is there a special variable such as $_ (which obviously is not it) that contains the matched value?#!/usr/bin/perl -w use strict; my $longstring="first<!--NEWENTRY889700-->last"; my @entries=split(/<!--NEWENTRY\d\d\d\d\d\d-->/,$longstring); print "$entries[0] $entries[1]\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: split/matching/regex question
by Roy Johnson (Monsignor) on Apr 14, 2004 at 20:09 UTC | |
by Art_XIV (Hermit) on Apr 14, 2004 at 20:23 UTC | |
|
Re: split/matching/regex question
by kvale (Monsignor) on Apr 14, 2004 at 19:32 UTC | |
by Roy Johnson (Monsignor) on Apr 14, 2004 at 20:16 UTC | |
by kvale (Monsignor) on Apr 14, 2004 at 20:29 UTC |