use strict; use warnings; my @array; for (@ARGV) { if (-e) { push @array, $_; next; } warn qq{"$_" doesn't exist!}; } @ARGV = @array; print "@ARGV";