http://www.perlmonks.org?node_id=1055643


in reply to Re^3: I want you to convince me to learn Perl
in thread I want you to convince me to learn Perl

yep, that's what I meant with "more differences than that". OTOH, wether something is annoying (and how much so), very often is influenced by what you have been using before, or what you are used to. E.g. I had seldom need for anonymous subs, so didn't miss multiline ones :-)
  • Comment on Re^4: I want you to convince me to learn Perl

Replies are listed 'Best First'.
Re^5: I want you to convince me to learn Perl
by BrowserUk (Patriarch) on Sep 25, 2013 at 10:43 UTC
    I had seldom need for anonymous subs, so didn't miss multiline ones :-)

    You've never spread a sort block or map block or grep block over two or three lines?


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    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.

      something like this? (excerpt from App::tkiv)

      my @img = map { $_->[0] } sort { $tsort{$Option{thumbsorting}}->() } map { my $seq = m/(\d+)/ ? $1 : 0; [ $_, $seq, (stat "$Idir/$_")[7,9], lc $_, rand 1 ] } grep { my $if = "$Idir/$_"; # Sanity check. Minimal image size 100 my $s = -s $if; # Skip MacOS working copies $if =~ s{/\._([^/]+)$}{/$1} && -s $if and $s = 0; $s and $s > 100; } # convert can't deal with .ico files (yet) # Tk can deal with Tiff/NEF as of 804.027_501 with Tk::TIFF grep m/\.(jpe?g|gif|x[pb]m|png|bmp|tiff?|nef)$/i => readdir +IDIR;

      Enjoy, Have FUN! H.Merijn
      See, those little helpers are our friends. Don't good friends deserve a name? :-)
        Don't good friends deserve a name?

        Sorry. I see your smiley face, but I'm going to answer the question seriously: Absolutely frikkin' not :)

        Why contrive a name for something that will never be called anywhere else?

        Why contrive a name for a block of code that only makes sense in one place in the source?

        That will often will only work in one place in the source because it needs access to lexical variables in scope at that position (closures). If you make the blocks named subroutines, then they have to be declared out-of-line of where they are used, which means you now need to pass (what would be) closures via arguments; and that means making up more names for the formals.

        Take a look at this, and tell me, what would you name the two map blocks?

        And if you're going to go that route, how about naming the blocks for your while loops; and for loops; and if & elsif & else bodies; and ...


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        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.

        NO!

        Wasting time inventing a name for something I use once, ensuring the name is unique within its namespace, moving the three lines somewhere far away from the place they are used and risking someone calls them differently than originally intended, just because the author of the language could not think of a nice enough syntax? No thanks!

        Jenda
        Enoch was right!
        Enjoy the last years of Rome.