in reply to substr odd behavior with list arguments

I care because I'd like to do this: substr($string,a_subroutine_call_that_returns_offset_and_length(@some_args))

You can get Perl to ignore the prototype (that was explained by choroba) on Perl 5.16 and up via: &CORE::substr("abcdefg",@a)

Replies are listed 'Best First'.
Re^2: substr odd behavior with list arguments
by LanX (Saint) on Mar 22, 2021 at 16:33 UTC
Re^2: substr odd behavior with list arguments
by wfischer (Novice) on Mar 22, 2021 at 16:29 UTC
    ... And that's the "how," to make Perl act the way I want. Maybe I won't, though -- it might not be prudent to change the prototype on this low-level call. Thanks!
      it might not be prudent to change the prototype on this low-level call

      Note you're not changing it, just telling Perl to ignore it for that one call, meaning you get Perl's standard behavior of flattening the argument list. But indeed it means that you need to be certain that your subroutine will always return the offset and length; the workaround that choroba showed at least gives you the oppertunity to check that. And LanX's suggestion to wrap it in a sub is also good.