CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2008
    Posts
    9

    Perl - Calling another perl script from a currenly running script

    I am new to Perl scripting...

    Anyone please help me regarding this issue...

    I have a perl script ( such as a startup script or the initial script ) ... i have 5 others scripts ( which are like different scenarios and run after the startup script ) ..... i need not run all the 5 scripts always ... i run the startup script and i need to call the script based on any scenario ( among those 5 scenarios )... how can i do this????

  2. #2
    Join Date
    Mar 2007
    Location
    Montreal, Quebec, Canada
    Posts
    185

    Re: Perl - Calling another perl script from a currenly running script

    You can use the backticks (`) to execute a system command:
    Code:
    $result = `random system command`;
    This will execute "random system command" and then put the output of the command into $result.

  3. #3
    Join Date
    Mar 2007
    Location
    Montreal, Quebec, Canada
    Posts
    185

    Re: Perl - Calling another perl script from a currenly running script

    Oops, forgot a follow-up.

    Alternatively, if the scripts you want to run are Perl, you can use require:
    Code:
    #script 1
    
    .. random code ..
    
    if ( .. some condition .. )
        require "myOtherFile.pl"
    
    .. more random code ..
    This will take "myOtherFile.pl" and dump the code into that spot.
    Last edited by IllegalCharacter; June 26th, 2008 at 01:01 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured