944,149 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Unsolved
  • Views: 1499
  • Perl RSS
Nov 6th, 2009
0

variable concat and exec cmd question

Expand Post »
basically i need to have 2 variables.. concat them and put them into use.

here is what i have done so far:

Perl Syntax (Toggle Plain Text)
  1. #!/usr/bin/perl
  2.  
  3. $stats = ':/var/tmp/RtcTestHarness/currentTransactionStats.txt';
  4. $console = ':/var/tmp/RtcTestHarness/TestHarnessConsole.log';
  5.  
  6. $client_1 = '9.34.120.36';
  7.  
  8. #$com = $client_1.$stats;
  9. #print $com; the concat here looks fine...
  10.  
  11. system ("scp $client_1.$currentTranStats .");


anything wrong? missing the usage of chomp?
Similar Threads
k2k
Reputation Points: 15
Solved Threads: 1
Posting Whiz
k2k is offline Offline
351 posts
since Nov 2007
Nov 7th, 2009
0
Re: variable concat and exec cmd question
I'm on Windows and don't have the scp utility so can't test your code but I notice you use the variable $currentTranStats without having assigned a value to it.

Also note that while a dot between two text variables acts as the concatenation operator, a dot within double quotes is just a dot. For example,
Perl Syntax (Toggle Plain Text)
  1. DB<1> $x = 'hello';
  2. DB<2> $y = 'there';
  3. DB<3> print "$x.$y";
  4. hello.there
The values of the two text variables are interpolated into the resulting string, but the dot appears as a literal dot.
Reputation Points: 153
Solved Threads: 142
Master Poster
d5e5 is offline Offline
740 posts
since Sep 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Perl Forum Timeline: php coding
Next Thread in Perl Forum Timeline: suggestions for writing automation script





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC