in reply to Re^4: Control Structures
in thread Control Structures

Try explaining that to a mid-level perl developer or an experienced programmer who is still learning perl and watch their eyes glaze over. The problem goes away if you don't use trailing if() statements.

Replies are listed 'Best First'.
Re^6: Control Structures
by merlyn (Sage) on May 10, 2005 at 17:07 UTC
Re^6: Control Structures
by dragonchild (Archbishop) on May 10, 2005 at 17:41 UTC
    The problem goes away if you don't use trailing if() statements modifying my() statements. The trailing if() isn't the problem; the problem is when it's modifying a my() statement. Disallow that. Later, when they're ready, they'll ask why that specific prohibition and you'll explain it to them and they'll understand. In fact, you can almost consider that a rite of passage from journeyman to master.

    • In general, if you think something isn't in Perl, try it out, because it usually is. :-)
    • "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"
      I consider myself an "average" perl developer. I've never been a full-time developer, but I instantly understood the my $xx if () problem when I meet it, and avoid it since then.
      Sure, I could do it that way, but it's one more thing to remember, and since I don't actually need trailing if() for anything it's easier to just not use it. I tend to favor a coding style based on the fewest traps to remember and am willing to sacrifice lots of things that are cool but not really necessary in order to get there.
        You tell them brother!
        import re re.sub(r'Perl[^A-Za-z]*', 'Python ', 'Perl6::Rules')