in reply to length of string in array

Hi SavannahLion,

You are reassigning to $x each time through the loop. Add to it instead:

$x += length for @t[0..1];

Hope this helps!


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: length of string in array
by SavannahLion (Pilgrim) on Feb 28, 2017 at 23:10 UTC

    Aaagghh! I was so focused on trying to figure out why length for @t[0 .. 1] wasn't working as it should that I completely overlooked the assignment!
    So much time wasted!

    Sigh... many thanks