http://qs321.pair.com?node_id=214564


in reply to Re: Re^3: The Cost of Nested Referencing
in thread The Cost of Nested Referencing

Why? What's more readable about
foreach my $foo (@bar) { do_something($foo); }
than do_something($_) foreach @bar; ? All I see is twice as much to type and read with absolutely no difference to the clarity. Especially when you nest a few of those and it ends up something like
for $blah (@blah) { # ... # ... # ... if($whatever) { last; } while($foo) { if(@bar) { # ... while($baz) { # ... # ... # ... } if($whatever) { next; } elsif($snafu) { last; } else { # ... } # ... # ... } # ... } } # ... # ... }
It's atrocious. Please use a few last if ... and spare me the effort of having to eyeparse 15 levels of indentation.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re^5: The Cost of Nested Referencing
by lestrrat (Deacon) on Nov 20, 2002 at 18:39 UTC

    All I can say is that you probably don't have non-Perl programmers around you who look at your perl-ism laden perl code. I don't care myself - I think the perl-isms are cool, so I use them when it's code that only I look at. But when other people may look into it - who are not perl programmers - I try to write code that is as close to the common denominator

      Would you try to talk English such that understanding would be easier for a French? Update: choose your poison, I guess. :-)

      Makeshifts last the longest.

        when you're job depends on the fact that non-Perl programmers need to read your Perl code, YES.

        Please end this nonsense, I'm just saying I stay away making something readable only to Perl programmers. Just because you find that unbearable, there's no reason for you to beat it to death until I bow down and follow your style.

        I do this cause I need to. End of story.