in reply to executing a shell script from perl

Writing the algorithm/requirement as an HTML ordered list would help readability enormously.

Having said that, your use of startup script is somewhat ambiguous - do you mean a script to start an application or a script thats runs when the system starts ?

I suspect the answer you seek lies in the use of backticks ...

. . my $out = `shell_script`; if (! $out || $out !~ /\d/) { log_error; $out = `alternate_method`; } `bind_cpu $out`; . .
Have a look at perlfunc, perlop

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^2: executing a shell script from perl
by JavaFan (Canon) on Jan 13, 2009 at 16:14 UTC
    It's a bit unusual to have backticks in void context. Backticks are used to collect the output of the program - running backticks in void context kind of defeats that purpose. About the only reason you want to do this is that you know the program is going to generate output, and you don't want to see that output at all. Still, in such a case, I'd prefer:
    system "bind_cpu $out > /dev/null";
      Point taken JavaFan - can't disagree with any of that - I was obviously in too much of a hurry to give it [my response] anything like a _decent_ coating of thinking about ... in which case I'd've done something similar.

      Having said that, since system returns nothing except a return code c/w a signal number, > /dev/null is self-evidently superfluous.

      Update:

      In the light of the update from brother JavaFan, I refer the reader to my last response - which is self-prophesying since I self-evidently give that no thought either - my comment was true from the POV of view of returning output back to the script, but manifestly wrong from the user POV.

      A user level that continues to overstate my experience :-))
        Having said that, since system returns nothing except a return code c/w a signal number, > /dev/null is self-evidently superfluous.
        Not at all. There's a big difference between:
        system "ls -l /etc > /dev/null";
        and
        system "ls -l /etc"
        The former will not print anything. The latter will print the content of /etc.
      system "bind_cpu $out &> /dev/null";

      That hides all output.
Re^2: executing a shell script from perl
by usrlocal (Novice) on Jan 09, 2009 at 17:03 UTC
    yeah, when I formatted the question , the algorithm was looking ok. when I hit submit, it all became single line. let me try this and see if it works
      does the above logic also check f0or return code from the execution of the shell script?