$ cat x.pl foreach(glob('*.*')) { unlink if -f and !-s _; } foreach(glob('*.*')) { unlink if (-f $_) && !-s _; } $ perl -MO=Deparse x.pl use File::Glob (); foreach $_ (glob('*.*')) { unlink $_ if -f $_ and not -s _; } foreach $_ (glob('*.*')) { unlink $_ if -f $_ and not -s _; } x.pl syntax OK