Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Natural Sort / Windows sort problem

by huck (Prior)
on Oct 30, 2017 at 17:59 UTC ( [id://1202352]=note: print w/replies, xml ) Need Help??


in reply to Natural Sort / Windows sort problem

use strict; use warnings; use File::Find; my @finds=('D:/goodies/pdhuck/down1/perl/monks/winsorts'); my @fns=(); my $sub_want_info2 =sub { push @fns,$File::Find::name if -f $File::F +ind::name; }; find({wanted=>$sub_want_info2,no_chdir=>1}, @finds); use Encode qw/encode decode from_to/; ##http://code.activestate.com/lists/activeperl/21182/ ##https://gist.github.com/whitebell/5692575 my %fnt; for my $fn (@fns) {$fnt{encode('UTF-16LE', decode('UTF-8', $fn))}= +$fn;} use Win32::API; my $f = Win32::API->new("shlwapi.dll", "StrCmpLogicalW", "PP","I") +; my @fnts=sort { $f->Call($a, $b) } keys %fnt; @fns=(); for my $fntt (@fnts){ push @fns,$fnt{$fntt};} for my $fn (@fns){ print $fn."\n";}
result
D:/goodies/pdhuck/down1/perl/monks/winsorts/a1 D:/goodies/pdhuck/down1/perl/monks/winsorts/u2 D:/goodies/pdhuck/down1/perl/monks/winsorts/u100 D:/goodies/pdhuck/down1/perl/monks/winsorts/u200

Replies are listed 'Best First'.
Re^2: Natural Sort / Windows sort problem
by cr8josh (Sexton) on Oct 30, 2017 at 20:03 UTC
    Thanks! That solved other issues I was having! Now I just have to figure out what it's doing!!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1202352]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 02:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found