Re: subpattern reference using vaiable subpattern index
- From: "Mumia W. (NOSPAM)" <paduille.4060.mumia.w+nospam@xxxxxxxxxxxxx>
- Date: Mon, 29 Jan 2007 19:29:02 -0600
On 01/29/2007 09:17 AM, Yakov wrote:
I have submatch index in a variable, $SUB=5. How do I write submatch reference $5 using $SUB ?
Is ${$SUB} ok ?
my $SUB = 5;
my @matches = m/.../;
print $matches[$SUB];
2. Is there array of subpatterns ($1..$<N>) so I can take it's size ?
Yakov
Yes, after you have assigned the output from the match operator to an array.
my @matches = m/.../;
print scalar(@matches);
Read the documentation: Start->Run->"perldoc perlrequick"
--
Windows Vista and your freedom in conflict:
http://www.badvista.org/
.
- Follow-Ups:
- Re: subpattern reference using vaiable subpattern index
- From: anno4000
- Re: subpattern reference using vaiable subpattern index
- References:
- Prev by Date: Re: French Accents appear incorrectly...
- Next by Date: Re: Win32::OLE problem with iTunes SelectedPlaylist
- Previous by thread: Re: subpattern reference using vaiable subpattern index
- Next by thread: Re: subpattern reference using vaiable subpattern index
- Index(es):
Relevant Pages
|
|