• 1 Post
  • 84 Comments
Joined 1 year ago
cake
Cake day: June 12th, 2023

help-circle















  • The way it works is that there’s a symbol table entry for “foo” which has a slot for a hash, scalar, array, glob, etc.

    That leads to some super weird behaviour like, for example, if I declare a scalar, hash and array as “x”:

    $x = "sy";
    %x = (foo => "mb");
    @x = ("ol", "s!");
    

    You can access them all independently as you’re aware:

    say "x: ", $x, $x{foo}, @x; # Outputs:  x: symbols!
    

    But what’s really going to bake your noodle is I can assign the “x” symbol to something else like this:

    *z = *x;
    

    …and then the same thing works with z:

    say "z: ", $z, $z{foo}, @z; # Outputs:  z: symbols!
    

    Oneliner if you want to try it:

    perl -E '$x = "sy"; %x = (foo => "mb"); @x = ("ol", "s!"); say "x: ", $x, $x{foo}, @x; *z = *x; say "z: ", $z, $z{foo}, @z;'
    

    Congratulations! You now know more about one of Perl’s really weird internals than I’d wager most Perl programmers (I have literally never used any of the above for anything actually productive!)


  • The issue with pugs is not that they’re evil or bad creatures, it’s that humans have selectively bred them for their looks, but that’s lead to the animals suffering because their breeding means they have massive problems with breathing, their knees, spine, eyes, etc. That’s unfair on the animal.

    It’s like saying we want to eliminate genetic diseases like Down’s syndrome or Haemophilia. Nobody’s saying individuals with those conditions are bad, it’s that we don’t think people should be born with conditions that give them a worse life.

    Now for dogs it’s a bit more complicated because those conditions are afflicted upon them by us purely for aesthetics, and if dogs are banned that inevitably leads to some being killed which isn’t very fair on those animals, but if we can’t find a way to reverse the worst aspects of their breeding is the only way we can prevent further suffering.



  • dan@lemm.eetoTechnology@lemmy.worldPerl still relevant in 2023/24?
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    10 months ago

    You mean the fact that you can have a hash called %foo, an array called @foo and a scalar called $foo all at the same time? I agree that’s a weird choice and there’s potential for insanity there, but it’s pretty easy to just not do that…

    20+ years of Perl experience and while Perl has a load of idiosyncrasies that make it harder to work with than other languages, I don’t think that particular one has ever caused a significant problem.