Behavior of eval. : eval « System Functions « Perl






Behavior of eval.

      
#!/usr/local/bin/perl 

$myvar = 1; 
eval ("print (\"hi!\\n\"); \$myvar = 2;"); 
print ("the value of \$myvar is $myvar\n"); 

   
    
    
    
    
    
  








Related examples in the same category

1.Using eval to evaluate an expression
2.Using eval to test whether a function is implemented.
3.The eval command executes a snippet of Perl code