"Billy Patton" <> wrote:
> I have a string
> $expecxted_status = "!= 0";
> $status = 0;
>
> What I'm trying to do is
>
> if ($status != 0) {
> ...
> }
>
> How do I get the $expected_status to evaluate to the boolean that it is,
> in relation to $status?
>
> $a = '== 0';
> $b = '2';
> eval { "$b $a" }; warn $@ if $@;
You are using the block eval on something which just happens to be
a string. You probably want to do a string eval:
my $result = eval "$b $a"; warn $@ if $@;
print something_to_do_with($result);
> The above does nothing.
It does plenty. It prints nothing. Which is expected, as you
haven't told it to print anything.
Xho
--
--------------------
http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB