in reply to How to use system command in perl script?

imho unless you are explicitly wanting the exit status of gcc, and your prog, better to use backquotes in the following manner, to capture the output:
my $compileresult = `gcc code.cpp`; my $aoutresult = `./a.out`; #... parse aoutresult
...wufnik

-- in the world of the mules there are no rules --