the following script:

        my ($f,$g,$h);
        $_= "abcde";
        ($f,$g,$h)=/(a{0,1})(m{0,1})(b{0,1})/;
        print "scalar g defined after first regex\n" if defined $g;
        ($f,$g,$h)=/(a{0,1})(m){0,1}(b{0,1})/;
        print "scalar g defined after second regex\n" if defined $g;

produces:
        
        scalar g defined after first regex
        
why does '(m{0,1})' produce an empty scalar, while '(m){0,1}' an undefined 
scalar?

and what i'm really after is to say:

        ($f,$g,$h)=/(a{0,1})(m|mn){0,1}(b{1,1})/;
        
and have $g come out a scalar which is defined.

thanks,

Tom Arnall
north spit, ca



-- 
thanks,

Tom Arnall
north spit, ca

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to