Take the 2-minute tour ×

I am getting this warning:

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

When I run this code:

        `$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?)

share|improve this question
add comment

2 Answers

up vote 10 down vote accepted

There is a semicolon after eval.

share|improve this answer
Good Heavens. OK, I'm an idiot. –  mseery Nov 20 '08 at 1:35
And eval takes $_ as its default argument. Which lets you do things like: perl -wnE'say eval' but otherwise is not particularly useful. –  ysth Nov 20 '08 at 2:28
add comment

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...
share|improve this answer
Good point. Thanks. –  mseery Nov 20 '08 at 1:36
add comment

Your Answer


