in reply to unlink $file OR... OR..
Why not:
unless (unlink $file) { print "..."; push @list, $file; }
which at least avoids using a global array in the sub. If you need to do it a lot put the unlink into a sub:
DoDaUnlink ($file, \@list); sub DoDaUnlink { my ($file, $list) = @_; return if unlink $file; print "..."; push @$list, $file; }
|
|---|