#!/usr/bin/perl use strict; use warnings; use Text::CSV; die "Usage: $0 \n" unless @ARGV > 0; open (my $fh, '<', $ARGV[0]) || die "$ARGV[0]: $!\n"; my $csv = Text::CSV->new(); $csv->eol("\n"); my $sum = 0; while (my $row = $csv->getline( $fh )) { $sum = $row->[3]; if ($sum > 310) { $row->[3] = 'volemd'; } elsif ($sum == 70) { $row->[3] = 'volemd1'; } $csv->print(\*STDOUT, $row); } $csv->eof or $csv->error_diag(); close ($fh);