Why does my script report 'uninitialized value in eval “string”?

I am getting this warning:

Use of uninitialized value in eval \"string\" at myscript.pl line 57.

When I run this code:

eval;
{
        `$client -f $confFile -i $inputFile -o $outputFile`;
};

if( $@ )
{
        # error handling here ...
}

What is causing the error?

How can I fix the underlying cause? (Or otherwise suppress the warning?)

Answers


There is a semicolon after eval.


The eval here would do absolutely nothing anyway. Backticks never throw errors. It's not $@ but $? that you want to check.

Also, if you're throwing away the result, it may be a cleaner idea to use system. e.g.

system($client, '-f', $confFile, '-i', $inputFile, '-o', $outputFile) and do {
    #error handling here...
};

Need Your Help

Notepad++ regexp to search and replace with exceptions

regex notepad++

I'm a regexp newbie and I would like to know how to do a search and replace for the following case:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.