then you have just one stat per file, and the map block in the caller would just be "split" instead of yet another round of stat calls. (perldoc -f stat explains about using the underscore to refer to "the existing stat structure")for $f (grep { ! ( /^\.{1,2}$/ or -l "$path/$_" ) } readdir(DIR)) { if ( -f _ ) { push @files, "$path/$f " . -s _; elsif ( -d _ ) { push @files, @{&files( "$path/$f" )}; } }
Final update: these really are very minor issues -- they could be "optimizations" in some situations, but probably won't make a noticeable difference in how fast this app goes, given that most of the run time will be spent comparing file contents. Still, if it's easier to write code that runs a little faster, why not write it that way?
In reply to Re: Identical Files to Symbolic Links
by graff
in thread Identical Files to Symbolic Links
by PetaMem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |