perl -e \'system (\"crontab1 -l\");print $?\'
returns -1 as expected (program crontab1 doesn\'t exist)
perl -e \'system (\"crontab1 -l|
You are getting the exit status of the entire command, just as you should. If you want the exit status separately, you're going to have to run the commands separately.
#!/usr/bin/perl -e
system("crontab1 -l > /tmp/junk.txt"); print $?;
system("grep blah /tmp/junk.txt"); print $?;
as an example.