Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: substr odd behavior with list arguments

by wfischer (Novice)
on Mar 22, 2021 at 16:29 UTC ( [id://11130140]=note: print w/replies, xml ) Need Help??


in reply to Re: substr odd behavior with list arguments
in thread substr odd behavior with list arguments

... 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!
  • Comment on Re^2: substr odd behavior with list arguments

Replies are listed 'Best First'.
Re^3: substr odd behavior with list arguments
by haukex (Archbishop) on Mar 22, 2021 at 16:46 UTC
    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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-03-30 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found