Global symbol "$JAVA_HOME" requires explicit package name at 564926.pl
+ line 4.
Perl sees the variable $JAVA_HOME and replaces it with its value, which is empty. The strict pragma prevents you from inventing variables.
If all you want to do is get at the value of environment variables, these are all available in the %ENV hash:
my $res = $ENV{JAVA_HOME};
If you want to know how to pass strings that look like variable names to the shell via backticks, you need to quote the special chars:
my $res = `echo \$JAVA_HOME`;
|