more useful options | |
PerlMonks |
Onliner magic to remove filesby glasswalk3r (Friar) |
on Dec 23, 2014 at 19:40 UTC ( [id://1111215]=perlquestion: print w/replies, xml ) | Need Help?? |
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,
Alceu Rodrigues de Freitas Junior --------------------------------- "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill
Back to
Seekers of Perl Wisdom
|
|