Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: How can I group lines in a file?

by akho (Hermit)
on May 17, 2009 at 13:37 UTC ( [id://764508]=note: print w/replies, xml ) Need Help??


in reply to Re: How can I group lines in a file?
in thread How can I group lines in a file?

Are you sure it works? It does if HoA is declared as a hash, not as a reference.

Loss of clarity is kinda evident.

It sure is understandable to a native speaker of Perl; but the fact that this is considered "clear" gives the language a bad name.

Replies are listed 'Best First'.
Re^3: How can I group lines in a file?
by BrowserUk (Patriarch) on May 17, 2009 at 16:28 UTC
    It sure is understandable to a native speaker of Perl;

    It's Perl. You do have to understand Perl to understand it.

    but the fact that this is considered "clear" gives the language a bad name.
    • Does this combine a f b = (b >>=) . (return .) . f =<< a give Haskell a bad name?
    • How about this for Smalltalk?
      | s f | s := Prompter prompt: 'enter line'. f := Bag new. s do: [ :c | c isLetter ifTrue: [f add: c asLowercase] ]. ^f
    • Does this CH3(CH2)50CH3 give chemistry a bad name?
    • Or this y + ?y = ƒ(x+ ?x) = m (x + ?x) + c = m x + c + m ?x = y + m?x for mathematics?
    • Or this 1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Bxc6 dxc6 5. d3 Bb4+ 6. Nc3 Nf6 7. O-O Bxc3 chess?
    • Or this for physics?
    • Or this for choreography?
    • Or this musicians
    • ...

    Why do people expect Perl to look like Java or C and brand it with a '"bad name" when it doesn't?


    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.
      > It's Perl. You do have to understand Perl to understand it.

      You have to do more than that.

      As for the bullet points: sometimes people need complex stuff. However, they do not need obfuscated stuff. Being understandable and being clear are not the same thing. bichonfrise74's confusion demonstrates that; notice how zwon's solution did not raise questions.

      I myself often tend to devolve into one-liners, but that's not something to be proud of.

      Re Haskell: yes.

      > Why do people expect Perl to look like Java or C and brand it with a '"bad name" when it doesn't?

      Because they are human and want to understand stuff?..

        It's Perl. You do have to understand Perl to understand it.

        You have to do more than that.

        No. You just have to understand Perl. Not C; not Java; not C# or VB. Just understand Perl.

        If people are going to program in Perl, it behooves them--for their own benefit--to learn Perl. All of it, not just the bits that look like something else they've already done.

        As for the bullet points: sometimes people need complex stuff.

        The point is, to the exponents of those fields, none of those are particularly complex. You just have to understand the notation. And so it is with the Perl I posted.

        Being understandable and being clear are not the same thing.

        If you take the time to understand it, the code I posted is perfectly clear.

        1. Open a file.
        2. Populate a hash of arrays.
        3. Close the file.
        bichonfrise74's confusion ...

        I saw no confusion, just intelligent questions from someone wanting & willing to learn. That is what this place is all about after all.

        not something to be proud of.

        It has nothing to do with pride. It is the natural progression of language development.

        • In assembler, those 4 lines would take about around 300 lines.
        • In C, it would take maybe 100.
        • In Java, say 30.
        • In Perl, just 4.

        Generations 1, 2, 3, and 4. That is the power of Very High Level Languages. That is what makes Perl programmers so productive. If the old metric of a reasonable programmer being able to write, test, debug and documement 10 lines of code regardless of the language; that makes a Perl programmer--who uses the full power of Perl to his advantage--far more productive than the Java programmer. Or those that insist on writing Java or C in Perl.


        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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://764508]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-19 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found