http://qs321.pair.com?node_id=151210

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

Is there anyreason that back ticks would not accept perl variables? This is all I can guess, but how do I call this rdes program from an exact directory plus the variables as well. I am in great need of help here.
#!/usr/local/bin/perl-Tw my $datpath = "/develop/release/cmsidev/dev/cr/cds/comms/x2p/ +LOGS"; my $INI_Ref_Number = 2; my $INI_Company_Code = 840; my $INI_CR2K_Number = 4308.01; print "$datpath \n"; system ('$datpath/rdes $datpath/xxx$INI_CR2K_Number.xml $INI_Ref_Numb +er $INI_Company_Code > error.dat ');

Replies are listed 'Best First'.
Re: Help with Back Ticks and calling a program with variables...
by VSarkiss (Monsignor) on Mar 12, 2002 at 20:16 UTC

    Um, I don't see any backticks there, but the reason the variables aren't getting interpolated is that you're using single quotes instead of double quotes. Just do this: system ("$datpath/rdes  $datpath/xxx$INI_CR2K_Number.xml $INI_Ref_Number $INI_Company_Code  > error.dat ");

    HTH