kapoor has asked for the wisdom of the Perl Monks concerning the following question:

Question: When I am trying to put $Latest in cat command in 2nd part of this script, obviously it does not work as it's no more a command, could anyone please tell how to implement $Latest variable data in cat command or is there other way to do.
my $Latest = `ssh root\@10.10.22.12 'cat /usr/local/LATEST'`; print $Latest; $path = `ssh root\@10.10.22.12 'cat /usr/local/$Latest/test.txt'`;

Replies are listed 'Best First'.
Re: How to: using file content in cat command
by rev_1318 (Chaplain) on Nov 06, 2009 at 12:56 UTC
    Remenber to chomp the result of your first shell-call:

    chomp $Latest;

    then it should work OK.

    Paul

Re: How to: using file content in cat command
by Anonymous Monk on Nov 06, 2009 at 01:33 UTC
    escape $Latest according to your shell rules?
Re: How to: using file content in cat command
by ambrus (Abbot) on Nov 06, 2009 at 12:55 UTC

    chomp