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