M
Mike Ballard
Probably didn't word title right but I have these:
$1 ne $3 && $2 ne $4
$1 ne $3 && $2 eq $4
$1 ne $3
and want to do this:
$filter = "\$1 ne \$3 && \$2 ne \$4";
or
$filter = "\$1 ne \$3 && \$2 eq \$4";
etc., depending on argv, right at the start of my code.
I want to define $filter based on argv so that instead of having 3
distinct/explicit "if ()" deeper in my code, I can have 1 "if ($filter)"
loaded with the argv-defined filter.
As I step through the code I can see that the correct filter gets selected
for "if ()" but the problem is it doesn't seem to be doing any evaluating
once there. I've tried all manner of escaping/quoting when defining
$filter but in the "if ()" it always evaluates the same way (and
incorrectly).
Is this some issue with the stmt evaluating only when $filter is defined,
and then later in the "if ()" it's going to remain static? Or is it just
how I'm trying to "protect" it from doing that when assigning it initially
to $filter?
If I'm allowed to do this, what do I have to do to make it work (I looked
at "eval" but gave up kinda quick on it)?
Mike
--
$1 ne $3 && $2 ne $4
$1 ne $3 && $2 eq $4
$1 ne $3
and want to do this:
$filter = "\$1 ne \$3 && \$2 ne \$4";
or
$filter = "\$1 ne \$3 && \$2 eq \$4";
etc., depending on argv, right at the start of my code.
I want to define $filter based on argv so that instead of having 3
distinct/explicit "if ()" deeper in my code, I can have 1 "if ($filter)"
loaded with the argv-defined filter.
As I step through the code I can see that the correct filter gets selected
for "if ()" but the problem is it doesn't seem to be doing any evaluating
once there. I've tried all manner of escaping/quoting when defining
$filter but in the "if ()" it always evaluates the same way (and
incorrectly).
Is this some issue with the stmt evaluating only when $filter is defined,
and then later in the "if ()" it's going to remain static? Or is it just
how I'm trying to "protect" it from doing that when assigning it initially
to $filter?
If I'm allowed to do this, what do I have to do to make it work (I looked
at "eval" but gave up kinda quick on it)?
Mike
--