[Israel.pm] how do I handle unknown number of captures ?

Yaakov Belch lists at yaakovnet.com
Wed Jan 28 03:13:00 PST 2004


>
>
>#!/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
>
>  
>

@res=$string=/(pattern)/g;  # should do the trick.

For example, I just typed into bash:
   perl -we '@res="abac--ad"=~/(a.)/g; print "@res\n"'
and received the answer:
   ab ac ad
Yaakov





More information about the Perl mailing list