in reply to eval sub
Also in the code the line below will cause an error to be thrown saying "Useless use of string in void context at test.pl line XX."
That's a warning, not an error.
What you have to understand is that eval { block here } and eval EXPRESSION are two fundamentally different things. The first one is like do { ... }, except that it catches excpetions (other languages call that try. do { "something" } warns because "something" doesn't serve any purpose, because it's not used anyway.
So you just want eval $Your_string_here.
Update: Forgot the links to the docs: eval.
|
|---|