in reply to column replacement evaluation on dataset

this is my solution so far. it has to loop through all the columns even though only 1 needs to be replaced

#!/usr/bin/perl use strict; use warnings; my $row = { a => 1, b => 2, c => 3, d => 4 }; my $evalStatement="a>0"; sub evaluateRow { my ($row) = @_; ## loop through each column a,b,c,d and if column exists in the evalua +tion statement ## replace column with value my $evaluateMe = $evalStatement; foreach my $colname (keys %$row) { my $val = $row->{$colname}; $evaluateMe =~ s/$colname/$val/g; } if (eval($evaluateMe)) { return 1 ## "ACCEPT row" } return 0 ## "REMOVE row" }