CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Return value of system()

 



applefreakpeeps
New User

Dec 14, 2009, 9:09 AM

Post #1 of 3 (2420 views)
Return value of system() Can't Post

system() seems to behave funnily here:

my $exit_val = system("perl -e 'use English; use strict; kill 11, \$PID");
print $exit_val;

I get 35584 (ie. Exit value: 139, Signal: 0, Coredump: 0) which is incorrect

If I write the same code in a separate perl file (say abc.pl) and execute abc.pl via system then:

my $exit_val = system("perl abc.pl");
print $exit_val;

I get 139 (ie. Exit value: 0, Signal: 11, Coredump: 127) which is correct.

Can anyone please point out the reason for this discrepancy?


shawnhcorey
Enthusiast


Dec 14, 2009, 10:45 AM

Post #2 of 3 (2413 views)
Re: [applefreakpeeps] Return value of system() [In reply to] Can't Post

When I run this:

Code
my $exit_val = system("perl -e 'use English; use strict; kill 11, \$PID"); 
print $exit_val;

I get:

Code
sh: Syntax error: Unterminated quoted string 
512


__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".


applefreakpeeps
New User

Dec 14, 2009, 11:20 AM

Post #3 of 3 (2410 views)
Re: [shawnhcorey] Return value of system() [In reply to] Can't Post

sorry that should've been

my $exit_val = system("perl -e 'use English; use strict; kill 11, \$PID'");

anyways problem solved.. its coz when there is 1 scalar alone system() passes it as it is to sh instead of invoking execvp.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives