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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using perl sys command to launch perl scrip

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
currently I'm doing the following command

system( "$fnf", "$release", "$line", "u")

where

$fnf = "perl " . "$base" . "import_dump_and_drop"
$release = <a parameter> #and yeah I checked to make sure it had the right value
$base = &quot;/<dir_name>/<dir_name>/software&quot; #where dir_name is the appropritate directory structure

my problem is that at the beginning of the import_dump_and_drop script I placed a print &quot;HELLO WORLD&quot; and when I run the script above I don't get a thing...

if you have any ideas, suggestions, or comments they would be appriciated. thank you in advace
 
I notice two things, which may not be issues if they are just typos in your post:

1. You didn't include a space between the $base and the name of the script when you are concatanating in the $fnf assignment.

2. You didnt include the .pl extension in the name of your script.

Like I said these could be just typos during your post, but you may want to check them out. --Derek

&quot;Fear not the storm for this is where we grow strong.&quot;
 
First thank you.

second sorry $base should have read like this

&quot;/<dir_name>/<dir_name>/software/&quot;

so that the concat for $fnf would read

&quot;perl /<dir_name>/<dir_name>/software/import_dump_and_drop&quot;


as for the extentsion....

I'm on a unix box, and thus far I've never had to put the exention on the file name. and I have several files already running just fine

but since this scripts purpose is to run one scrip against a list of strings <listed in a seperate file> I don't know if that is going to have an tremendous changes, but I believe that since it is unix the system command will understand if the perl script doesn't have an extention so long as I call perl against it

 
You either have to make the system call all one string or put ALL of the arguments to the program as separate members of the list. Try changing the script to
Code:
my $perl = 'perl';
my $fnf = &quot;$base&quot; . &quot;import_dump_and_drop&quot;;
system( &quot;$perl&quot;, &quot;$fnf&quot;, &quot;$release&quot;, &quot;$line&quot;, &quot;u&quot;);

jaa
 
And, actually, you don't need quotes around variables in the list unless they are being cat'd to another string.
Code:
system( $perl, $fnf, $release, $line, &quot;u&quot;);

It improves the readability some [bigglasses]

jaa
 
Thank you all every much :)

It is working very happily right now, I appricate your all's time and responces. Have a great day
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top