No, this is not a stupid question. Just a couple of months ago I was asking the same question, but now I use eval quite a bit. Once you use it a few times you will understand it. Here is a case where I used it recently, I hope this example will clear it up for you a bit. -- eval { my $net = 'Net::DNS'; require $net; if ($@) { # $@ returns null for success. so if $@ is not null. do_stuff(); } } -- Why eval here ? Eval is runtime as well as require, use is compile time, ie. if i declare use Net::DNS and there is no Net::DNS the modules halts and won't run. The eval is for testing to see if Net::DNS is installed, if it's not install the error is saved in $@ so if $@ is set, then there is no Net::DNS and we do our stuff, if $@ is empty we use Net::DNS. > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] > Sent: Monday, August 13, 2001 3:05 PM > To: [EMAIL PROTECTED] > Subject: eval > > > A rather stupid question but I would appreciate a good answer........ > > What is the point of the eval function. What would be a > reason to use it. > From what I gather it is a function that evaluates a piece of > Perl code and > returns the exit status of the code. > > What is the point. Why no just write code and check for exit status of > commands where such a check is necessary......... > > Could it have something to do with run-time code > generation............. ?? > > Pardon my ignorance, I am still learning. > > TIA > Ismar > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]