in reply to Have to abruptly return in a regex
> "oXoXoXoX" =~ /(?:.X(?{return "Yes n=$n" if ++$n==$m}))*/
looks like a very complicated way of trying
DB<44> sub func { my ($m)=@_; return "Yes n=$m" if 'oXoXoXoX' =~ /(? +:.X){$m}/ } DB<45> p func(0) Yes n=0 DB<46> p func(2) Yes n=2 DB<47> p func(4) Yes n=4 DB<48> p func(5) DB<49>
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|