in reply to Regex question

if ( $string =~ m/(foobar)/ ) { $match = $1; } else { $match = "chiapet"; }

Replies are listed 'Best First'.
Re: Re: Regex question
by carric (Beadle) on Mar 19, 2004 at 22:37 UTC

    Uch.. problem is I'm doing a BUNCH of stuff within the "if" loop based on this match..

    if ( $string =~ m/(foobar)/ ) { $match = $1; push (@array, $match); bunch of other stuff... }

    I'll try and do some more fiddling with the else though..

    Thanks

      problem is I'm doing a BUNCH of stuff within the "if" ...

      I can't see where there would be a problem yet. Do you care to explain?

      On a side note: if does no loop. Call it an "if-block". Cheers, Sören