my $script = 'perlscript.pl'; if (`perl -c $script 2>&1` =~ /syntax OK/) { print "$script compiles\n"; } else { print "Parsing $script failed\n"; }