Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Evaluate the content of a variable

Status
Not open for further replies.

Bruni007

Technical User
Joined
May 29, 2006
Messages
20
Location
CA
Hi,

At the beginning of my perl script, i've written the following line to use Tivoli commands under unix and it works fine...
use Shell qw(wcrtadmin wassignop wpostzmsg wsndnotif wdel);

I've create a variable..
$command = "wcrtadmin -r user"

The problem is that I don't know how to evaluate the content of $command
With bash, I would have done:
eval $command

I don't know how to do the same with Perl....!
 
The Shell module is not recommended for use in "real" systems. If you want to run external commands, use backticks (the return value is the output of the command you've run), i.e.:
Code:
my $command_output = `wcrtadmin -r user`;
 
ok thx

I'm pretty new with Perl, I didn't know the backticks were acting that way...

Can you also tell me how I would source the following script with Perl instead of Bash

In a Bash script I would have done it this way:
. /var/setup.bash

I've tried to put it between backticks,but it doesn't work

I need the value of an environment variable from the above script...I thought it would have possible to add it to
%ENV
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top