Charles Oppenheimer [mailto:[EMAIL PROTECTED]] wrote:
> Hi folks. I have a question... I wanted to create a > sub procedure that takes an operator as an argument, > like so: > > &compare(1,"<",2); > > sub compare { > my ($value1,$operator,$value2) = @_; > > if ($value1 $operator $value2) { > print "statement is true!!\n"; > } > > } I've never actually done this, so I'm somewhat guessing here, but you might be looking for something like: sub compare { my ($a, $o, $b) = @_; if (eval("$a $o $b")) { print "True!\n"; } } Note that this is completely untested -- you may need to work a bit harder to get the eval block to return the value correctly... HTH, Ricky _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs