473,239 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,239 software developers and data experts.

how to run the perl script by passing it's arguments using system ??

Hi all,

i have perl script, which is used to send mail. its a command line utility.
if we run this perl script in command line by passing all it's required arguments, it works very well.there no issues.

my problem is :
am just call this perl script by using "system" command inside the another perl script. ie,

mail.pl --contains:
Expand|Select|Wrap|Line Numbers
  1. system(perl sendEmail.pl -f bbb.aaa@ccc.co.uk  -t aaa.ddd@eee.co.uk -s aaabbbcc.ddd.com -u "Test Mail" -m "Test Mail");
here arguments stands for:

-t ADDRESS [ADDR ...] to email address(es)
-u SUBJECT message subject
-m MESSAGE message body
-s SERVER[:PORT] smtp mail relay.

when i try to run mail.pl, i get this error :
Expand|Select|Wrap|Line Numbers
  1. C:\sendEmail-v1.55>perl mail.pl
  2. Array found where operator expected at mail.pl line 1, at end of line
  3. Array found where operator expected at mail.pl line 1, at end of line
  4. syntax error at mail.pl line 1, near "pl -f "
  5. Execution of mail.pl aborted due to compilation errors.
am not able to sort this problem ??

am using Win2k OS & Activestate V5.10.0 perl.
can any one help me out this ????

Sep 23 '08 #1
3 8038
3,509 Expert Mod 2GB
You are going to really run into a lot of syntactical issues calling that the way that you are. My suggestion would be to convert your sendmail.pl script into your own internal module that you can include in your script(s) and call the code as a function with all the necessary options. It would be a cleaner way to do it, especially since it appears this will not be a one-off solution, but instead used over and over.


Sep 23 '08 #2
174 Expert 100+
First off, i agree with numberwhun on that point,

second your getting errors because,

Expand|Select|Wrap|Line Numbers
  1. system(perl sendEmail.pl -f bbb.aaa@ccc.co.uk -t aaa.ddd@eee.co.uk -s aaabbbcc.ddd.com -u "Test Mail" -m "Test Mail");
try this:

Expand|Select|Wrap|Line Numbers
  1. system(`perl sendEmail.pl -f bbb.aaa@ccc.co.uk -t aaa.ddd@eee.co.uk -s aaabbbcc.ddd.com -u "Test Mail" -m "Test Mail"`);
you forgot to cancel the @, - .... etc.

also i think to help you find problems we will need a print out of sendEmail.pl code.

also on another note: have you read the other post you posted
Sep 23 '08 #3
Hi Jeff/Icecrack,

Thanks for your valueable suggestions.

i used icecrack 1st solution, it worked :-)

really, i would love to takeup jeff idea & implement..since am runningout of time..
i had to choose other one...

anyway's thanks guys for your help & support..your doing great work..!!!
please keep going..it helps all perl newbie's...

ahhh icecrack.. i have seen the other post which u have replied..am still not yet tried that one...

Sep 24 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Robert Rozman | last post by:
Hi, I'm total php newbie and probably have trivial problem. I have following two scripts. First creates web form and should run second script with two arguments. But those two arguments don't...
by: Olivier Scalbert | last post by:
Hello , What is the python way of doing this : perl -pi -e 's/string1/string2/' file ? Thanks Olivier
by: PzYon | last post by:
Hey 2gether! I'm trying to execute a PERL script on the web server when the user presses a button in an ASP.NET Web Application using Visual Basic. The most obvious solution for me seemed to be...
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
by: =?iso-8859-1?q?Luis_M._Gonz=E1lez?= | last post by:
Please forgive me if what I'm asking is non sense... I created a little program to authomate the creation of the "setup.py" script for py2exe. It simply prompts for the main executable script...
by: thumbiko | last post by:
I read some discussion on this topic however I am faced with the same problem of passing a php variable into a perl script. I want to pass a string from a php script to a perl script which is called...
by: rahulthathoo | last post by:
Hi, After i finish some amount of computation using a perl script, i need to send out an email to a receipient which can change and is known to the Perl script. Is there a way to call the...
by: alokvping | last post by:
I have written a perl script in which i have mentioned 4 $ARGV, $ARGV,...etc . While passing an argument to the script i want to pass arguments as strings. Like one argument value should contain n...
by: coolheadash | last post by:
Hi All, I have a got a perl script with me, which takes 2 html files as an argument and 3rd field where the diff between html files ll be stored. This I can run on a command line by passing the...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.