in reply to sorting an array of file names
What's wrong with sorting numerically?
#!/usr/bin/perl use strict; use warnings; my @data = <DATA>; { no warnings 'numeric'; print sort { $a <=> $b } @data; } __DATA__ 29.30.force.0.5.1LGY.pdb 30.31.force.0.5.1LGY.pdb 100.101.force.0.5.1LGY.pdb 9.10.force.0.5.1LGY.pdb 31.32.force.0.5.1LGY.pdb 200.201.force.0.5.1LGY.pdb 201.200.force.0.5.1LGY.pdb 101.102.force.0.5.1LGY.pdb
Output:
9.10.force.0.5.1LGY.pdb 29.30.force.0.5.1LGY.pdb 30.31.force.0.5.1LGY.pdb 31.32.force.0.5.1LGY.pdb 100.101.force.0.5.1LGY.pdb 101.102.force.0.5.1LGY.pdb 200.201.force.0.5.1LGY.pdb 201.200.force.0.5.1LGY.pdb
(if that's not the ordering you want, please post how exactly you want the sample list to be ordered)
|
|---|