#!/gov/ecf/bin/perl -w use strict; use warnings; my $records = 'scott.d3'; my $FhIn; open $FhIn, '<', $records or die "Could not open $records: $!"; while( my $line = <$FhIn> ) { my ( $county, $year_x, $yr_tot ) = split ' ', $line; if ( $year_x eq "1" ) { $year_x += $yr_tot; print "$county $yr_tot\n"; } elsif ( $year_x eq "2" ) { $year_x += $yr_tot; } elsif ( $year_x eq "3" ) { $year_x += $yr_tot; } elsif ( $year_x eq "4" ) { $year_x += $yr_tot; } } close $FhIn or die $!;