Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Can you explain me the output of this programme. especially in the subroutine func2

by atemon (Chaplain)
on Nov 26, 2007 at 16:18 UTC ( [id://653021]=note: print w/replies, xml ) Need Help??


in reply to Re: Can you explain me the output of this programme. especially in the subroutine func2
in thread Can you explain me the output of this programme. especially in the subroutine func2

SORRY !

Bug 6: sanketkathalkar, you are calling func1 & func2 as  func1(@arr); and  func2(@arr); where you pass array itself, instead of array reference. So when you shift the arguments, you are getting the first element, which is being printed.
ikegami fixed this in the code he posted.

  • Comment on Re^2: Can you explain me the output of this programme. especially in the subroutine func2
  • Select or Download Code

Replies are listed 'Best First'.
Re^3: Can you explain me the output of this programme. especially in the subroutine func2
by ikegami (Patriarch) on Nov 26, 2007 at 16:45 UTC

    No, that's actually correct for a prototype of (\@). (Notice how func1(@arr); worked correctly?) The whole question was about why the prototype wasn't working for func2.

Re^3: Can you explain me the output of this programme. especially in the subroutine func2
by cdarke (Prior) on Nov 26, 2007 at 16:47 UTC
    That's one of the things the prototype does. If you specify (\@) then passing an array func1(@arr) is correct. Passing func1(\@arr) would actually fail the prototype check (as would suppling a list instead of an array). ikegami had to pass a reference because the prototype was removed.

    Update: my reply overlapped with that of ikegami
      Update: my reply overlapped with that of ikegami

      Why the update? Why apologize for posting correct information?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-04-24 06:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found