#!/usr/bin/perl use strict; use warnings; my $base = 0.425; while ( my $line = ){ chomp $line; my ($z,$c1,$c2,$c3,$c4) = split(/,/,$line); print join("|",$z,$c1,$c2,$c3,$c4),"\n"; my $total = $c1+$c2+$c3; print $c4 == ($total + $base) ? "True\n" : "False $c4 != ".($total+$base)."\n"; } __DATA__ 00501,0.000,0.425,0.025,0.875 00544,0.000,0.425,0.025,0.875 06390,0.000,0.425,0.025,0.875 #### 00501|0.000|0.425|0.025|0.875 True 00544|0.000|0.425|0.025|0.875 True 06390|0.000|0.425|0.025|0.875 True