Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Printing the elements of array

by Not_a_Number (Parson)
on Jan 16, 2012 at 17:47 UTC ( #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; }


Comment on Re: Printing the elements of array
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2014-10-02 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (46 votes), past polls