in reply to Perl Drag Racing - sum/delta list
I'm probably missing something but it seems to me you are making life hard by calculating that running total or whatever it is?
Why not just store the original first value and the deltas?
#! perl -w use strict; sub decode { my $val; return map { $val += $_ } @_; } my @input = qw( 1000 1 -21 44 -1 ); my @output = decode @input; print "@output", $/; __END__ C:\test>190239 1000 1001 980 1024 1023
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Perl Drag Racing - sum/delta list
by John M. Dlugosz (Monsignor) on Aug 16, 2002 at 15:04 UTC |