http://www.perlmonks.org?node_id=564927


in reply to taking an output in a variable

Hi there,

Your mistake is that perl interpolates $JAVA_HOME before the echo command is executed and I guess $JAVA_HOME in your code isn't defined.

Try $ENV{JAVA_HOME} to get the variable you want.

If you insist (for any reason) to use the echo command's output or need to bypass the perl interpolation, write \$JAVA_HOME.

Enjoy,
Mickey