in reply to sub will not return data correctly (the way i want it to!!)

Maybe <DATA> is out of data by the time you get to test_2?

Replies are listed 'Best First'.
Re^2: sub will not return data correctly (the way i want it to!!)
by james28909 (Deacon) on Jun 18, 2015 at 01:34 UTC
    0x10 = 16 characters for first sub
    0x40 = 64 characters for second sub

    it is easy to see that in sub 2 it is reading 0x40 (64) in length and that __DATA__ is 0x50(80) in length.
Re^2: sub will not return data correctly (the way i want it to!!)
by james28909 (Deacon) on Jun 18, 2015 at 00:26 UTC
    __DATA__ is 0x40 in length for sub test_2. Each iteration of the for loop should return 0x10 in length.

      return returns from the subroutine. It doesn't push data through a channel. If you want to return a collection of data from multiple loop iterations, you'll have to collect it first.