in reply to Re^2: Dynamic if loop
in thread Dynamic if statement

yes if executes conditionally i want to execute the same if statement for different conditional word against different input word.. it may look as below.. foreach $ruleword(@splitrule) { if($word=~m/$ruleword/igs) { print "\t$word\tmatched\n"; } }

Replies are listed 'Best First'.
Re^4: Dynamic if loop
by BrowserUk (Patriarch) on Mar 25, 2010 at 14:28 UTC

    When your code snippet is wrapped in <code> ... </code> tags, it looks like this:

    foreach $ruleword ( @splitrule ) { if( $word =~ m/$ruleword/igs ) { print "\t$word\tmatched\n"; } }

    And that looks fine (except the /g is probably not useful in this context). So why do you think you need to generate code?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.