Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: on the fly reference to subroutine output

by tmharish (Friar)
on Mar 04, 2013 at 14:54 UTC ( #1021663=note: print w/ replies, xml ) Need Help??


in reply to Re: on the fly reference to subroutine output
in thread on the fly reference to subroutine output

Just as a note - this beautiful solution works cause Perl flattens arrays.

You can see that when you do:

sub2( [ sub1(), (), () ] );


Comment on Re^2: on the fly reference to subroutine output
Download Code
Replies are listed 'Best First'.
Re^3: on the fly reference to subroutine output
by ISAI student (Scribe) on Mar 04, 2013 at 15:12 UTC
    Thank you all. It does the "magic".
Re^3: on the fly reference to subroutine output
by 7stud (Deacon) on Mar 05, 2013 at 02:45 UTC
    How does 'flattening' come into play when there's only one array? I would think 'unwiding' of an array is what takes place.

      There are two arrays ( one inside the other ). The outer array is the anonymous array as shown below:

      sub2( [ sub1() ] ); ^ ^ | | | --------- Inner array ------------ Outer array
      sub 2 now gets the ref of the outer anonymous array which is flattened.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2015-07-08 06:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls