Eval

Updated: 04/26/2017 by Computer Hope

Short for evaluate, eval is a function that can be found in various different interpreted and compiled programming languages. This function can have a variety of different abilities depending on the programming language you're using. For example, in Perl, PHP, and JavaScript the eval command can be used to interpret a variable string as code and execute it.

Example of eval in Perl

In the above example, the string stored in the $example variable is executed using the eval command. A programmer could take this expression further by executing a complete Perl program stored in another file.