in reply to Cumulative sum not working as it should be

I get this result if I comment the print statements in the block, if i uncomment then the cumulative some doesn't work.

Because this: print $token->[1], $/ if $nested = 0 && ... assigns 0 to it.

That should be: print $token->[1], $/ if $nested == 0 && ...


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Cumulative sum not working as it should be
by nehavin (Initiate) on Jan 07, 2014 at 10:30 UTC

    Thanks for your help. One more doubt please.......what does "$/" do before if?? I tried googling it out but could not get anything.

      see perlvar

             $/      The input record separator, newline by default.

      some ppl are too lazy to type "\n" :)

      Cheers Rolf

      ( addicted to the Perl Programming Language)