Quote:
>after reading about the eval command I am still fuzzy on how it works.
> Am I right in thinking that it is basically the system command, but working
> from within the perl program?
Hmm, sort of, I suppose.
It passes the string you give compiles it up and executes it there and
then. All your perl variables etc - including "local" and "my" variables
- are available, and can be modified.
It's just like the "eval" in the shells, if that helps.
It has a secondary use, since fatal errors in the eval don't cause the
outer interpreter to exit, so you can defatalise some errors (e.g.
"socket not implemented on this perl").
It's rarely needed, especially with all the fancy stuff in Perl 5.
I've found that in 80%+ cases where I'd use eval in perl 4, an anonymous
sub does the trick in perl 5 - this doesn't have to be recompiled all
the time, so is quicker.
Ian