I apologize for kicking the dead llama but I think you're right. This is
exactly what I was looking for. Thanks!
From the perl documentation:
eval EXPR
eval BLOCK
In the first form, the return value of EXPR is
parsed and executed as if it were a little Perl
program. The value of the expression (which is
itself determined within scalar context) is first
parsed, and if there weren't any errors, executed
in the context of the current Perl program, so
that any variable settings or subroutine and
format definitions remain afterwards. Note that
the value is parsed every time the eval executes.
If EXPR is omitted, evaluates $_. This form is
typically used to delay parsing and subsequent
execution of the text of EXPR until run time.
In the second form, the code within the BLOCK is
parsed only once--at the same time the code
surrounding the eval itself was parsed--and
executed within the context of the current Perl
program. This form is typically used to trap
exceptions more efficiently than the first (see
below), while also providing the benefit of
checking the code within BLOCK at compile time.
The final semicolon, if any, may be omitted from
the value of EXPR or within the BLOCK.
----- Original Message -----
From: "Metzger, Phil (COMPRINT S)" <[log in to unmask]>
Sent: Tuesday, June 27, 2000 2:18 PM
Subject: Re: macro substitutions in Perl/iX
> Pardon my pummeling of a rotting llama, but I mentioned the question to a
> friend last night who promptly giggled at me and said "eval". Turns out
> that eval will interpret variables into literals and process the whole as
> code. Methinks that means that:
>
> $foo = '\"pine\" ne \"elm\"';
> eval "while ($foo) { giggle(); }";
>
> should turn into:
>
> while ("pine" ne "elm") { giggle(); }
>
> and be evaluated as code, not a string.
>
> I promise to attempt to let this die now, especially since I have a very
> feeble idea of what macros in cobol on the HP are. Methinks this is what
> you might have been looking for though.
>
> ePhil.com
> Wetmore Fulfillment
> PH: 713-856-4491
> FX: 713-466-7970
> PG: 281-268-6139
>
>
> -----Original Message-----
> From: Eben Yong [mailto:[log in to unmask]]
> Sent: Monday, June 26, 2000 2:23 PM
> To: [log in to unmask]
> Subject: macro substitutions in Perl/iX
>
> Hello-
>
> COBOL allows for macro substitutions, and I'm wondering if
> the same
> functionality is present in Perl? If so, where in the
perl
> documentation
> can I find it? Thanks as usual for any help.
>
> Eben Yong
> MIS Manager
> Health Plan of San Mateo
>
|