1 3 5 2 7 6 3 10 7 #### 1 3 5 2 4 6 3 3 4 #### #!/usr/bin/perl use strict; use warnings; my $prev_2 = 0; while () { my ($c1, $c2, $c3) = split; printf "%3d %3d %3d\n", $c1, $c2-$prev_2, $c3; $prev_2 = $c2; } __DATA__ 1 3 5 2 7 6 3 10 7 #### 1 3 5 2 4 6 3 3 7