Hi,

In the documentation with your perl, the document perlfunc describes
eval much more concisely and accurately than I could.

There is a difference between

eval("\$ret=\$data\=\~$filter");

and

eval { $ret = $data =~ $filter };

which perlfunc explains.
Note that the second form isn't interpolating a string to get the code.

I think you are assuming that
eval { $a + $b = $c; }

would mean that $c is always the same? This isn't the case. The second
form of eval is pretty much like any other scope contained within {}
(subject to a few caveats described in perlfunc).

On the warnings, I may have misunderstood, but if you don't want
warnings - could you switch them off when you deploy the code?

Regards

Mark


Nelson R. Pardee wrote:
> Mark,
> I don't think I can use the block form, or am I confused? Maybe if I
> change the form slightly I can do it. But the values of the variable do
> change
> eval("\$ret=\$data\=\~$filter");
> 
> I suppose I could strip the slashes and any modifiers from $filter and
> rewrite it thus: eval{"\$ret=\$data\=\~/\$filter/\$mods"}
> 
> I understand this may be faster, but it's not clear from my
> documentation what it would do differently. Is that what you had in mind?
> 
> And- how can I trap the warning? In this case it's coming from an embedded
> $ in my string (which I can look for), but I'm concerned about other
> warnings that I might not anticipat:-) Thanks again for the help!

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to