On Sat, 19 Feb 2005, Alberto Fernandez wrote:
> Hello, i am new in Perl and i have a doubt that i think is very easy to 
> result.
> I have this portion code:
> 
> my $string = "cccabccc";
> my @array =$string =~ /ab|a/g;
> 
> I execute this and array contains 1 element with value "ab".
> 
> I would like to know if there is some way for array contains all the 
> matches "ab" and "a".(container and contents).

Not that I can think of.  The regular expression matches just one
substring.  If you want to allow that any given art of the original target
string might be matched by different patterns, you'll need to to match
against each of those patterns separately.  In this case, the following
would work,

    my @array = ($string =~ /ab/g);
    push @array, ($string =~ /a/g);


TomP

-------------------------------------------------------------------------
Tom Pollard                                       [EMAIL PROTECTED]
Schrodinger, Inc.                                    646-366-9555 x102
-------------------------------------------------------------------------


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to