#!/usr/bin/perl use warnings; use utf8; use strict; my $arguments = shift; if ( system("gcc $arguments") == 0) { #can we complie the file? print "C file.. opening... \n"; open (FH, '<', $arguments) or die("No file: $!\n"); while ( ) { print $_; #read it, edit it or whatever needed } } else { print "Not a C file\n"; }