Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: Differ. array and List

by Jasper (Chaplain)
on Apr 26, 2005 at 15:57 UTC ( #451645=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Differ. array and List
in thread Differ. array and List

However, there are some subs which expect their arguments to be array variables (because the variable's data will be altered). Examples include pop() and shift().

I think this is incorrect. Any list of arguments supplied to a subroutine are inserted into the array @_ and pop and shift handle that accordingly. There's no such thing as subs expecting array variables.


Comment on Re^3: Differ. array and List
Re^4: Differ. array and List
by halley (Prior) on Apr 26, 2005 at 16:02 UTC
    Uh, write a Perl subroutine that works exactly like pop() without (1) taking a (@) prototype signature, and (2) expecting that $_[0] is an lvalue array reference. I'd like to see the code.

    --
    [ e d @ h a l l e y . c c ]

      Oops. I don't think I thought about what I was writing, and I certainly don't seem to have read what you wrote. However, from my (probably limited) understanding of @, \@ whatever prototyping, the context is relatively limited and has to emulate a function call. You can't use any of this for method calls, for example. I see what you mean, though.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2014-12-23 05:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (135 votes), past polls