Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Printing the elements of array

by Not_a_Number (Prior)
on Jan 16, 2012 at 17:47 UTC ( [id://948188]=note: print w/replies, xml ) Need Help??


in reply to Printing the elements of array

use strict; use warnings; my @array = ( 5, 4, 10 ); my $start = 1; my $sum = 0; for my $num ( @array ) { $sum += $num; print "$start-$sum\n"; $start += $num; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-03-28 23:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found