[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
> 
> 
> TIA
> 

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";
for(;$a<length$b;$a+=9){print+pack"b8",substr$b,$a,8;}'

My public key: 
http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=0x3D2CA0A8



More information about the Perl mailing list