Perl eval Function
This function evaluates EXPR at execution time as if EXPR were a separate Perl script. This allows you to use a separate, perhaps user-supplied, piece of Perl script within your program. An eval EXPR statement is evaluated separately each time the function is called.
The second form evaluates BLOCK when the rest of the script is parsed (before execution).
Following is the simple syntax for this function:
eval EXPR eval BLOCK
This function returns value of last evaluated statement in EXPR or BLOCK
Following is the example code showing its basic usage:
When above code is executed, it produced following result: