WTF?
my $limit = shift;
$limit = 100;
if (!$limit) {
$limit = 20;
}
OMG...
my @files_raw = <$directory/*>;
my @files = sort { lc($b) cmp lc($a) } @files_raw;
OMFG...
foreach my $file (@files) {
if ($i < $limit) {
$i += 1;
# [...]
}
}
JFC...
LOL (Score:1)
middle part makes sense (Score:2)
Re: (Score:2)
That does make sense, but here's a bit more context (I tried posting only code in the above post):
- There are thousands of files in that directory (which implies the sort shouldn't be done that way)
- While the OS does make case-insensitive distinction, all the filenames are numbers (which both means that the lc is not doing anything useful, and that the comparison should not be done with cmp)
There. Is it scary now? :-)
FWIW, I don't have to do anything to this code, I just have to create the
that's nothing (Score:0)
Try this one:
Re: (Score:2)
My first thought when I read "that's nothing" was: "Indeed... There's thousands more lines just like this one..."