Excuting perl script from within a perl script with variables.

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Excuting perl script from within a perl script with variables.
# 1  
Old 12-10-2013
Excuting perl script from within a perl script with variables.

Not sure what I am doing wrong here, but I can print the list with no issue. Just a blank screen with the 'do'.

open FILE, "upslist.txt";
while ($line=<FILE>){
if ($line=~/^(.*?),(.*?)$/){
#print "ups:$1 string:$2\n";
do 'check_snmp_mgeups-0.1.pl -H $1 -C $2';


# 2  
Old 12-10-2013
Try using double quotes with the do
Single quotes don't allow interpolation of variables.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

PERL: In a perl-scripttTrying to execute another perl-script that SETS SOME VARIABLES !

I have reviewed many examples on-line about running another process (either PERL or shell command or a program), but do not find any usefull for my needs way. (Reviewed and not useful the system(), 'back ticks', exec() and open()) I would like to run another PERL-script from first one, not... (1 Reply)
Discussion started by: alex_5161
1 Replies

2. UNIX for Dummies Questions & Answers

Variables in perl script

Hi Chaps, Im after some advise with a script i've written however doesnt appear to work how I would like. Basically I have a perl script which sucessfully pulls an expect script to login to multiple nodes and obtain some output from the nodes (total number of nat ports that are in use... (0 Replies)
Discussion started by: mutley2202
0 Replies

3. Shell Programming and Scripting

Perl : embedding java script with cgi perl script

Hi All, I am aware that html tags can be embedded in cgi script as below.. In the same way is it possible to embed the below javascript in perl cgi script ?? print("<form action="action.htm" method="post" onSubmit="return submitForm(this.Submitbutton)">"); print("<input type = "text"... (1 Reply)
Discussion started by: scriptscript
1 Replies

4. Shell Programming and Scripting

executing perl script from another perl script : NOT WORKING

Hi Folks, I have 2 perl scripts and I need to execute 2nd perl script from the 1st perl script in WINDOWS. In the 1st perl script that I had, I am calling the 2nd script main.pl =========== print "This is my main script\n"; `perl C:\\Users\\sripathg\\Desktop\\scripts\\hi.pl`; ... (3 Replies)
Discussion started by: giridhar276
3 Replies

5. Shell Programming and Scripting

calling a perl script with arguments from a parent perl script

I am trying to run a perl script which needs input arguments from a parent perl script, but doesn't seem to work. Appreciate your help in this regard. From parent.pl $input1=123; $input2=abc; I tried calling it with system("/usr/bin/perl child.pl $input1 $input2"); and `perl... (1 Reply)
Discussion started by: grajp002
1 Replies

6. Shell Programming and Scripting

Perl :How to print the o/p of a Perl script on console and redirecting same in log file @ same time.

How can i print the output of a perl script on a unix console and redirect the same in a log file under same directory simultaneously ? Like in Shell script, we use tee, is there anything in Perl or any other option ? (2 Replies)
Discussion started by: butterfly20
2 Replies

7. Shell Programming and Scripting

Use the same perl script with several different variables

I'm new to perl and have to create these files for my job. I have a script that I can run that will create the file, but I have to manually pass the variables to it. It is dumb and it takes a lot of time. I want to be able to pass the existing perl script a set of variables (the same variables... (4 Replies)
Discussion started by: smartin114
4 Replies

8. Shell Programming and Scripting

pass perl variables to shell script

I have a perl script that opens a text file containing numbers on each line: for example: 755993 755994 755995 755996 755997 755998 The perl script takes these numbers and store them as an array @raw_data, where I can access individual numbers by using $raw_data for the value 755993.... (2 Replies)
Discussion started by: xchen89x
2 Replies

9. Shell Programming and Scripting

Need help passing variables in shell script to perl one-liner

I'm writing a script to automate some post-install tasks on RHEL4 servers. I need the following code to insert an 'A' in the middle of a string, then replace the string in a file. I know I can use sed to do this, but I'd like to use perl's in place edit so I don't have to write to a temp file,... (1 Reply)
Discussion started by: Xek
1 Replies

10. Shell Programming and Scripting

accessing variables declared in another perl script

Hi all, I have a perl script which declares two variables and calls another perl script which accesses those variables. But I am unable to access the variables in the called script. My script is as follows: my $ENV{a}="20"; system("perl called.pl"); and my called.pl contains: print... (3 Replies)
Discussion started by: gurukottur
3 Replies
Login or Register to Ask a Question