use File::chmod; while (<>) { close ARGV; chmod "u+x", $ARGV if /^#!/ and not -x $ARGV; }