[Israel.pm] Re: Unknown number of captures

Yosef Meller mellerf at netvision.net.il
Wed Jan 28 08:15:16 PST 2004

Uri Itscowits <uri at itzko.hopto.org> Wrote:
> #!/usr/bin/perl  to all,
> I want to run a capturing regex, with an unknown number of captures as a result,
>  how do I refer to the resulting list?
> for example :  
> regex like:  /(Ab)/g

The @- array holds the begining index of all successful matches, the @+ 
array the end indexes. the number of captures will be "scalar @-".
perldoc perlvar has a lot to say aboput it including some dood examples.

perl -e'$b=unpack"b*",pack"H*","59dfce2d6b1664d3b26cd9969503";

My public key: 

More information about the Perl mailing list