Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^4: Massive expansion of a hash of arrays?

by Amblikai (Scribe)
on Jul 20, 2014 at 20:42 UTC ( [id://1094396]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Massive expansion of a hash of arrays?
in thread Massive expansion of a hash of arrays?

Thank you so much for taking the time to explain this code. There was a lot in there that i couldn't get my head around, so your explanation is very much appreciated. I'm actually now using the code so it's good that i now know how it works!!

A final point, i tried to move the subroutine definition below the code calling it (I like to keep all my subs at the bottom), but i get an error:

Can't call method "nForX" without a package or object reference at ./test.pl line 617.

Is there a reason for this? And how do i store the sub somewhere else?

Replies are listed 'Best First'.
Re^5: Massive expansion of a hash of arrays?
by farang (Chaplain) on Jul 20, 2014 at 23:32 UTC

    A final point, i tried to move the subroutine definition below the code calling it (I like to keep all my subs at the bottom), but i get an error: Can't call method "nForX" without a package or object reference at ./test.pl line 617.
    It seems you'll need to add a forward declaration with the prototype in order to move the sub definition below the calling code.

    sub nForX(&@); ... nForX { print join ' ', @_; } 3, \( @a, @b, @c ); ... sub nForX(&@) { #use of prototype here is actually irrelevant #now, i.e. sub nForX {...} works the same ... }

      Ok, Thanks!!

Log In?
Username:
Password:

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

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

    No recent polls found