Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

the sad reality of perl

by morgon (Priest)
on Oct 09, 2018 at 22:15 UTC ( [id://1223757]=perlmeditation: print w/replies, xml ) Need Help??

Replies are listed 'Best First'.
Re: the sad reality of perl
by stevieb (Canon) on Oct 09, 2018 at 22:37 UTC

    ...is that these folks can't even recognize a very well known data structure when they see it. It's JSON data.

    It should be accessed accordingly, not with regex which will break on the slightest change.

    use warnings; use strict; use Data::Dumper; use JSON; my $json = <DATA>; my $perl = decode_json $json; print Dumper $perl; __DATA__ {"maps":{"idOthers":{"label":"Others","state":1,"bkmrk":{"id1517321708 +544042":{"label":"Thornbury","latlng":"-37.758959,145.002408","z":15} +,"id1517404948177044":{"label":"SE Oz","latlng":"-37.383253,146.79931 +6","z":7},"id1524907539056020":{"label":"Melbourne wide","latlng":"-3 +7.736512,145.266724","z":10},"id1526128108894092":{"label":"Melbourne + city","latlng":"-37.814412,144.963698","z":15}}}},"portals":{"idOthe +rs":{"label":"Others","state":1,"bkmrk":{"id1519870156505020":{"guid" +:"bd3c83881e864833a1d6ba7f74d48932.16","latlng":"-28.101867,140.19891 +2","label":"Moomba Airport"},"id1524017293988041":{"guid":"5d28dfb8e5 +c74235bcb6ebabe7db137e.16","latlng":"-38.052737,140.699065","label":" +MacDonnell Water Tower"},"id1524017431668144":{"guid":"cef5a3a6052b4d +b5918f240633c87d1a.16","latlng":"-35.354197,145.725536","label":"Horg +an Walk"},"id1524017542894278":{"guid":"981d883b207a4f469d1cfd6ef6a83 +c99.16","latlng":"-35.651077,145.572401","label":"Finley and District + Museum"},"id1524017595214323":{"guid":"9c02931bd84a44f09d0eb7d528440 +dde.16","latlng":"-40.121934,148.016741","label":"Flinders Anchor"}," +id1524018796438428":{"guid":"729ba75fe8af4915ad0171398308dd1a.16","la +tlng":"-34.276904,146.053927","label":"Griffith Water Tank 3"},"id152 +4018933096574":{"guid":"f9f356e2a6cb4311b8d5e6b8597e9f10.16","latlng" +:"-38.379673,141.369564","label":"The Blowholes"},"id1524573178960029 +":{"guid":"4807ea2a1f5446eca437f30d00249070.16","latlng":"-35.812108, +145.564549","label":"Murraay Valley Trail"},"id1524573424316121":{"gu +id":"da1fa66c47e04ab8bd63ca889477fc64.16","latlng":"-35.919043,145.64 +944","label":"Cobram Court House"},"id1525240907654076":{"guid":"f7f0 +413875e849f0bd4144deeb2e1dd3.16","latlng":"-37.10952,142.412065","lab +el":"Keep Wildlife Wild"},"id1524573612772224":{"guid":"ee648daae1954 +dfaae922dbf8b73b628.16","latlng":"-35.355555,145.725977","label":"Jer +ilderie Library"}}}}}

    Get the data from the structure, and it can be used properly. The main fault of that entire post is that everyone was assuming it was "text".

      We know, but someone ought to post that to the original thread. Preferably someone who's already registered there. <hint> <hint>.

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

      You right of course.

      But it's beside the point.

      The point is that people still try to use perl by using snippets from the internet that they don't understand, fail to accomplish their task and finally the problem gets solved using python.

      The sad reality of perl in 2018.

        People will be doing that forever.

        Using Python for Perl, using XXX+ for C, using I_dont_know_what_im_doing for I_never_knew_what_i_was_doing.

        Currently, Python is the de-facto "school" language (as far as I can tell) for "Computer Science" folk. It happens. Languages change.

        What upsets me mostly is that there are "instructors" and "educators" out there through "colleges" charging exorbitant amounts of money who claim the staff know what they're doing, sinking people into debt with no real edumication.

        Point is, don't use snips of anything online for anything useful without knowing what they are:

        "The problem with Internet quotes is that you can't always depend on their accuracy" -Abraham Lincoln

        "The point is that people still try to use perl by using snippets from the internet that they don't understand, fail to accomplish their task and finally the problem gets solved using python."

        This has nothing to do with perl and everything to do with people. It would be more accurately written as:

        People still use snippets from the internet that they don't understand, often it doesn't do what they expect and often someone else throws them a solution that they copy and paste without understanding what it does.

        This behavior is so common in outsourcing, you wouldn't believe the scale of it.

Re: the sad reality of perl
by tybalt89 (Monsignor) on Oct 09, 2018 at 23:25 UTC

    It's more like "the sad reality of expecting others to do your work for you"

    Just for fun (semi-untested :)

    perl -lne 'print for grep /^[A-Z]/, split /"/' bookmarks
Re: the sad reality of perl
by Anonymous Monk on Oct 10, 2018 at 00:13 UTC
    Who answers a question about Perl with Python? An evangelical member of the "Python Everywhere" cult! I propose a counter initiative that I like to call, "PERL EVERYWHERE!" that requires you to answer every question you see about Python with an answer in Perl! Ridicule them for not declaring variables. Savage them for worshipping whitespace. This is war. Stop being so nice to those who would destroy your world. FIGHT TO WIN!

      ...or don't fight at all; just... code ;)

        I've just started looking at JSON data, and for (my) educational purposes, would like to see how the entire task gets done in the greatest generality. It seems that all of the values for 'label' are the ones beginning with caps. JSON material gets bought up in SoPW fairly frequently, but I don't see any tutorial about it as I scroll through. (Maybe a question like this could motivate one.)

        There seems to be a fair amount of CPAN material with it: https://metacpan.org/search?q=JSON
        ...or don't fight at all; just... code ;)

        While code is definitely the best remedy, I believe that not fighting back when being openly, obnoxiously, constantly, attacked is not a viable strategy. Not when we are surrounded by broken robots with pockets full of google cash chanting "python everywhere", which means "perl (and all others) nowhere". That kind of totalitarian ideology is deeply offensive to The Programming Republic of Perl and should be dealt with by something other than ignore-ance. Some will fight with code, others with mere barewords strung together as sentences, and hopefully most will do both.

        "Damn the torpedoes! ...go ahead! ...full speed!".
        Admiral David G. Farragut

      > Who answers a question about Perl with Python?

      Someone like John D. Cook, a "Scientific Python" consultant, who trolls Perl6 feeds with unsolicited advice about his favorite snake-oil:

      twitter.com/zoffix/status/1040354046744449025

        Haha, battle of the snake-oil salesmen! Your pythonista trolling a "Perl6ista" selling the fact that you can write 223 in the source code in his language. Because that's *so* much easier than writing 2**23 ...

        (In fact, the closest I can get in vim 8 is 22 3, with: "2 Ctl-K 2 S Ctl-K 3 S" because "Ctl-K 23" is interpreted as 2/3...)


        The way forward always starts with a minimal test.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-26 00:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found