in reply to Perl 'grammar'

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^2: Perl 'grammar'
by Erez (Priest) on Jan 09, 2008 at 10:45 UTC

    Perl programs written in a style that is as close to C as possible are more easily understood by most other programmers.

    Something like this?

    undef $/; my @text = split (//, <$FILE>); for (my $i = 0; $i <= $#text; $i++) { my $j = $i; if (($text[$i++] == 'h' || $text[$i++] == 'H') && $text[$i++] == 'e'...) { while ($j <= $i) { print $text[$j++]; } } }

    I'll be the first that would recommend a solid foundation in programming, C or otherwise, but writing Perl as if it was C, isn't what would make your Perl better understood by other (Perl?) programmers.

    Software speaks in tongues of man; I debug, therefore I code.
    Stop saying 'script'. Stop saying 'line-noise'.

Re^2: Perl 'grammar'
by Anonymous Monk on Jan 09, 2008 at 20:37 UTC
    given your post history it is obvious that you know nothing about Perl,C or computers in general. So how the hell can you just spout out crap like this, given that you know nothing about either?
Re^2: Perl 'grammar'
by m.att (Pilgrim) on Jan 14, 2008 at 13:30 UTC

    Wow.. I can't disagree more.

    The best Perl programmers are the people who embrace Perl's unique features and capabilities and use them effectively. The best programmers are those that know multiple languages and can easily differentiate between the features and virtues of those languages such that they can determine when and where the use of that language is appropriate.

    I can't think of a single language out there where it's appropriate to write it in the style of another language to make it readable by other programmers. In fact, I can think of several horror stories that illustrate the absolute contrast of this point. (One example that jumps to mind is a C header file I once saw that adds #defines that allow you to write C in the style of COBOL. I tried to find the spot where I saw this originally but was unable to.. if anyone knows what I'm talking about, I'd love to see it. :)

    Win - Can you provide any supporting argument to your statement? Examples where Perl code written in 'C-style' is more 'readable' than in 'Perl-style'?

    m.att