in reply to Perl version dependent code
How about:
use if $] ge '5.016', feature => 'fc'; use if $] lt '5.016', 'Unicode::CaseFold' => 'fc';
See Unicode::CaseFold. Otherwise you could do:
*case_insens = $] ge '5.016' ? sub { &CORE::fc($a) cmp &CORE::fc($b) } : sub { lc $a cmp lc $b }; @list = sort {case_insens()} @list;
Update: Used &CORE::fc() instead of CORE::fc() so that it really does work on older Perls.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Perl version dependent code (updated)
by Laurent_R (Canon) on Jan 24, 2019 at 22:50 UTC | |
by haukex (Archbishop) on Jan 25, 2019 at 11:38 UTC | |
Re^2: Perl version dependent code (updated)
by Aldebaran (Curate) on Feb 03, 2019 at 22:13 UTC | |
by hippo (Bishop) on Feb 04, 2019 at 09:29 UTC | |
by Aldebaran (Curate) on Feb 05, 2019 at 09:05 UTC |
In Section
Seekers of Perl Wisdom