Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions


Posted on 2001-06-25
Last Modified: 2010-03-05
I've got 2 scripts, 1 smaller script with a lot of subs in it and 1 really large script.

Now I want to perform this:

From the smaller script I want to run 3 subs and then the large script should be executed (I have no idea how to call that script from within the smaller script), after executing the large script it should continue with another 4 subs from the smaller script.

You can quess my question: How to call the large script from within the smaller script and when the large script has executed the smaller script continues.
Question by:saskia
  • 2
  • 2
  • 2

Accepted Solution

shayb022800 earned 50 total points
ID: 6226322
You can do one of two things:
If you do not need the "big" scripts output within the "small" script you can call it with the "system" command or with back quotes like this:
system "big_script.pl";
$return_val = `big_script.pl';

you can transform one of your scripts into a package and then include that package in the other script like this:

small_script.pm #end the file name with .pm
1;#important at the end of the package

use "path/small_script.pm";  #include the above file

func1() # call a function from the package
big_func() # this scripts func
func2() # call a function from the package


Author Comment

ID: 6226366
Please don't propose an answer, maybe other people have a better solution for me.

- The big script does give output.
- I don't want to call functions from the small script from within the bigger script, because the big script will become 'unreadable' due to it's size.


Expert Comment

ID: 6226387
You can do the opposite , call the big script from the small one!
Or you can prepare a third script which calls them both!
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Expert Comment

ID: 6238508
shayb has covered all the bases

Author Comment

ID: 6239631
ok, quess i've got to do it with this... thanks

Expert Comment

ID: 6239829
just to stick my nose in again, I think making the second script (the one that contains multiple sub-routines) a module would make the most sense:

that way, if any of those subroutines proved to be useful, you could reuses them in later code.


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
compress files in RAR using perl 13 83
Question about @INC variable in perl 1 65
unable to remove invisible characters with perl 2 89
perl syntax 3 16
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question