Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: length of string in array

by 1nickt (Canon)
on Feb 28, 2017 at 21:27 UTC ( [id://1183199]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-23 17:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found