I take it you'd like to send one command off to do its work while you start another one? You should look at forking a new process for each task, or using threads to divy up the processing work. For instance, here's a quick and dirty start:

use strict; use warnings; use threads; my ($thr, @threads); INPUT: print "What do you want me to do?\n"; my $work = <STDIN>; chomp $work; if ($work eq "permissions") { $thr = threads->create(sub { print `sh /root/scripts/security.sh` }) +; push(@threads, $thr); #keep track of the thread print "security.sh sent into background\n"; goto INPUT; } elsif ($work eq "apachelog") { $thr = threads->create(sub { print `perl /root/scripts/apachelog.pl` + }); push(@threads, $thr); #keep track of the thread print "apachelog.pl sent into background.\n"; goto INPUT; } elsif ($work eq "exit") { $_->join() for @threads; # cause threads to return home after finish +ing. exit 0; }

Hope that helps.


"The dead do not recognize context" -- Kai, Lexx

In reply to Re: Executing a program or series of programs in perl. by djantzen
in thread Executing a program or series of programs in perl. by mikey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.