#! perl -slw use strict; my %ops; for my $op ( qw[ < <= == >= > != lt le eq ge gt ne ] ) { $ops{ $op } = eval "sub{ \$_[0] $op \$_[1] }"; } printf "Enter criteria: "; my( $f, $op, $c ) = split ' ', ; local $\; while( <> ) { my @f = split ','; print if $ops{ $op }->( $f[ $f ], $c ); }