zenshade said:
Subject: Newbie problem with perl and rsh
I council you not to use the word "newbie" in subject lines - it tends
to predispose people against you. To see why see numerous previous
thread with "newbie" in the subject. Many the OPs in those threads
display behaviour with which you would do well not to associate yourself.
Similarly avoid the words "Perl" and "problem" in subject line in
comp.lang.perl.* as they are usually redundant. Clear and concise
subject lines are very important to the co-operative nature of Usenet.
Wasting space in them will be perceived as an uncooperative act and so
will also serve to predispose people against you.
Your problem has nothing to do with rsh. Had you tried replacing 'rsh'
with 'echo' you'd have found the problem persisted. This process is
known as "problem partitioning". It is an absolutely vital skill in
programming. If you think your problems lies elsewhere than it does
then you are unlikely to find a solution.
On the whole not a great subject line
I'm trying to invoke a perl script with command line arguments on
server 2 from server 1. Here's what I do on S1:
$output=`rsh $host ./getdigits.pl $co_id $contact_id`;
Here's what I have on S2:
die "Wrong number of arguments." if $#ARGV!=1;
my ($co_id, $contact_id)=($ARGV[0],$ARGV[1]);
The script dies every time on S2 with "wrong args" message. Only one
argument is being passed to the script on S2. The second argument is
interpreted as a bad command on S1.
How do I work around this?
At a guess I'd say remove the linefeed from the end of $co_id.
Most likely you have a chomp() missing in your program somewhere.
I can't say where because you didn't show us a minimal but complete
script. It is stongly recommened that you post a minimal but complete
script to illustrate your problem. This process alone will often solve
your problem or at least serve to verify your partitioning of the problem.
Pretty much all the advice I've given here (and much more besides) can
be found in the posting guidelines for this group. I stongly advised
you to take a look.