[BioPython] Perl Question

shahzeb niazi shahzeb656@hotmail.com
Mon, 06 Jan 2003 19:20:36 +0000


I want to pass a math operator to a subroutine. The subroutine is supposed 
to search for certain values according to a criteria passes, e.g ==, <, > 
... now, the quick and dirty way to do this would be to just have a 
variable, say $criteria, with numbers and then a bunch of if/elsif in the 
subroutine for each number. However, I'm curious: is there a way to use a 
scalar as an operator? Something like this maybe:

$criteria = "<"; $value1 = "1"; $value2 = "2";

if($value1 $criteria $vaue2){ print "$value1 is smaller than
$value2\n"; }

Of course the above wouldn't work, but thinking back to bash, there
was this 'eval' function... is ther something similar in Perl?


_________________________________________________________________
MSN 8: advanced junk mail protection and 2 months FREE*. 
http://join.msn.com/?page=features/junkmail