Syntactic Confectionery Delight | |
PerlMonks |
Re: sorting an array of file namesby Xilman (Hermit) |
on Dec 19, 2009 at 16:35 UTC ( [id://813533]=note: print w/replies, xml ) | Need Help?? |
I suggest you read up on the sort() function, whether chewed trees in the Camel book or with "perldoc -f sort". sort() can be given a function to define the sorting order. Your specification, "sort these files with respect to their first digit" is somewhat ambiguous. What do you want to do if two files have the same first digit? What do you want to happen if the file doesn't have a first digit? If I assume that you don't care what happens when a file doesn't contain a digit and when two files contain the same first digit, something like this might be what you require:
Paul
In Section
Seekers of Perl Wisdom
|
|