On Tue, 2005-10-04 at 19:55 +0530, [EMAIL PROTECTED] wrote: > Hi Dan > Could u plz elaborate ur logic in detail I think it might work.............. > Mayank Ahuja
<!BACK TO THE LIST!> Hi Mayank, You really need to work this out for yourself. You should try and submit some code so that people can correct you rather than write your script for you. Read perldoc -f system. Example: If I have a script, in my case on my linux machine, and I want to run that script using another script then I use the `` however you can use: #!/usr/bin/perl system("./my-script <input>") where <input> is the file you feed the script. You also need to look at the logic for catching any errors, for instance: open(FILE, $file) || die "Error: $file: $!\n"; I am not sure if the logic reverses for system calls (I can't think why I think that but I do!). So if you want to make a wrapper for you programs then make sure you either hard code the output of your first program as the input to your next, else you need to make your program accept a file or whatever on the command line using the @ARGV setup. #!/usr/bin/perl `./my_script1 input1`; `./my_script2 output_of_script_1`; `./my_script3 output_of_script_2`; As I said earlier I am not sure if the backticks (``) work on a win machine so you may have to use the system command above. I am sure there are probably numerous ways of doing this some better than I have suggested, if you have a better way please tell me! Thanks Dan. > Team Member > Tata Consultancy Services Limited > Ph:- 044-55555816 > Cell:- 9283199460 > Mailto: [EMAIL PROTECTED] > Website: http://www.tcs.com > Dan Klose <[EMAIL PROTECTED]> > 10/04/2005 07:31 PM > To > [EMAIL PROTECTED] > cc > beginners@perl.org > Subject > Re: regd. executing one perl file inside another perl file > On Tue, 2005-10-04 at 15:31 +0530, [EMAIL PROTECTED] wrote: > > Hi perlers > > > > > Hello. > > I have one query regarding how to execute one perl file with in the > > another perl file. > > The problem is like this I have to do 2-3 tasks by running 2-3 perl script > > for each task ............... in some order.... > > say, for first order I have to run one perl file which give me one output > > file in text format. > > And for the next task this test file generated is fed as input then it > > generates one more text file. then for the task 3 the text file generated > > by task 2 file is made to input and then it genearates some text > > file........and so on.......... > > > > So in the nut shell I want to do all this task by executing only one perl > > file........... > > which will call all the perl file in the order in which i > > need.............. > > So could u plz tellme is there any function thriugh which I can do this > > way..................... > > > yes. > see the perl system command. > #!/usr/bin/perl > use warnings; > use diagnostics; > use strict; > `./perl_script1`; > `./perl_script2`; > system("./perl script3") || die "blah blah blah $!"; #NOT SURE IF THE > LOGIC HERE IS REVERSED I DON'T USE IT AT ALL YOU CAN FIND THAT OUT. > exec("./final.pl"); > this assumes you hard code the output of script1 as input to script2 and > script2 to script3. > Oh also I haven't tested this and I don't use windows, but it might work > on linux and with minor mods on windows. > > Will the execute() funtion solve the purpose .....................which we > > use in DBI etc................. > I don't think so. > I think your . button maybe stuck! > HTH > Dan. > > > > > > thankX > > > > n > > With warm regards > > > > > > > > > > Mayank Ahuja > > Team Member > > Tata Consultancy Services Limited > > Ph:- 044-55555816 > > Cell:- 9283199460 > > Mailto: [EMAIL PROTECTED] > > Website: http://www.tcs.com > > > > Notice: The information contained in this e-mail message and/or attachments > > to it may contain confidential or privileged information. If you are not > > the intended recipient, any dissemination, use, review, distribution, > > printing or copying of the information contained in this e-mail message > > and/or attachments to it are strictly prohibited. If you have received > > this communication in error, please notify us by reply e-mail or telephone > > and immediately and permanently delete the message and any attachments. > > Thank you > ForwardSourceID:NT0000B782 > Notice: The information contained in this e-mail message and/or attachments > to it may contain confidential or privileged information. If you are not the > intended recipient, any dissemination, use, review, distribution, printing or > copying of the information contained in this e-mail message and/or > attachments to it are strictly prohibited. If you have received this > communication in error, please notify us by reply e-mail or telephone and > immediately and permanently delete the message and any attachments. Thank you -- Daniel Klose PhD Student - Taylor Group Mathematical Biology National Institute for Medical Research The Ridgeway Mill Hill London NW7 1AA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>