glasswalk3r has asked for the wisdom of the Perl Monks concerning the following question:
Greetings monks,
I'm trying to figure out how this onliner to remove files works:
for(<*>){((stat)[9]<(unlink))}The "*" in the diamond operator is something I can't find any document about it.
Also, calling stat (which will hit $_, filled by the diamond operator of any filename in the current directory) and getting a slice of it (returning mtime of the file as the ninth element of the list) makes no sense to me, specially how the filename information is being given to unlink.
Besides that, calling stat for me makes no sense at all... I could be calling unlink directly, couldn't I? At least it works if I replace everything with an print "$_\n" inside the for loop.
Here is the reference from where I fetched this onliner: http://www.slashroot.in/which-is-the-fastest-method-to-delete-files-in-linux.
Thanks,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Onliner magic to remove files (useless)
by tye (Sage) on Dec 23, 2014 at 19:57 UTC | |
by mr.nick (Chaplain) on Dec 23, 2014 at 20:04 UTC | |
|
Re: Onliner magic to remove files
by LanX (Saint) on Dec 23, 2014 at 20:07 UTC | |
|
Re: Onliner magic to remove files
by Anonymous Monk on Dec 24, 2014 at 01:14 UTC | |
|
Re: Oneliner magic to remove files
by Anonymous Monk on Dec 24, 2014 at 19:09 UTC |