in reply to (jeffa) Re: Using File::Find with a bit of elegance
in thread Using File::Find with a bit of elegance
How? By 'decorating' each filename in the list with a newline. Oops!sub trim { return map { s/\.mp3\z/\n/; $_ } sort @_; }
Better would be the following:
Of course, the downside is two maps instead of one, but, this is better when making generic, robust, reusable subroutines. Allowing the client to make this decision could very well cut back on the number of modifications required for that subroutine.sub trim { return map { s/\.mp3\z//; $_ } sort @_; } # and decorate it in the 'client' print DB map {"$_\n"} trim(@files);
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|