my @sources = grep /\.c$/, glob '*'; # get only the files ending in .c from a listing of the working directory my @objects = map s/\.c$/\.o/, @sources; # get the list of object files that a c compiler would make by default from the files now in @sources my @virgins = map { my $c = $_; $c =~ s/\.o$/\.c/; system "cc $c"; $c } grep !(-f), @objects; # find and compile the uncompiled sources