perl -E 'sub x{say;for(<$_/*>){&x;unlink}};x for@ARGV' *
perl -E 'push@ARGV,<$_/*>for@ARGV;say,unlink for@ARGV' *
Re:Useful Perl one-liners (2013)
by EvilTerran on Wednesday November 30, 2016 @04:48AM
(#13069534)
Isn't that just "rm -rv *"? The original spec was to only delete files, not directories - and only those matching a given pattern, at that.
Also, I think yours would go into an infinite spin if it met a symlink loop (say, "ln -s . foo") - File::Find is hardened against that kinda shenanigans.
Hello!
You might even be able to do 'find{...}"."' (no "sub" or ","), but I don't have perl on my phone to test that ;)