Reader's Clinic - EVAL
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Sprezzatura Ltd | 01 MAY 1991 | 2.03+ | EXPERT | EVAL, CATALYST, COMPILE |
Simon Rayne faxed recently with details of a problem he was having with the EVAL statement. It seemed that the statement following prints the value "1" instead of 2!
eval @ans = 1 ; call catalyst("C","@ans=2") ; print @ans
This is because neither EVAL nor CATALYST call the preprocessor called by the COMPILE statement (the routine responsible for upper case conversion, INSERTS etc). Thus the @ans = 2 fails to compile correctly. Mr Rayne points out that the fix to this is to use uppercase! (i.e. replace @ans with @ANS).
(Volume 3, Issue 1, Page 15)