Login
You're viewing the oslo.town public feed.
  • May 6, 2026, 10:46 AM

    @phl I wonder if that error message is an issue. I wouldn't expect it to work anyway, because pop really expects an array, as it has to modify it. I don't think it can do that with the list split generates.

    That is, it seems more in the category of "Can't modify constant item" than "Experimental pop on scalar" ... and I don't think it's the context.

    1> pop split /bla/, $str
    Experimental pop on scalar is now forbidden

    💬 1🔄 0⭐ 0

Replies

  • May 6, 2026, 10:49 AM

    @fuzzix Good point. I guess the can't modify constant item one would be more appropriate (although also somewhat confusing :D)

    And yeah, here's me confusing lists with arrays 25+ years into the Perl world still :D It's I guess a bit of a footgun.

    💬 1🔄 0⭐ 0
  • May 6, 2026, 11:34 AM

    @phl Just tried out perl 5.12 (the version before experimental "Array and hash container functions accept references") and got a much more helpful message:

    $ perl -E 'my $str="fooblabar"; pop split(/bla/, $str);'
    Type of arg 1 to pop must be array (not split) ...

    💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0