/usr/share/perl5
NameSizeModeActions
Attribute/-0755rm
B/-0755rm
Class/-0755rm
Compress/-0755rm
Config/-0755rm
CPAN/-0755rm
DBM_Filter/-0755rm
Devel/-0755rm
encoding/-0755rm
ExtUtils/-0755rm
File/-0755rm
Getopt/-0755rm
I18N/-0755rm
IO/-0755rm
IPC/-0755rm
Locale/-0755rm
Math/-0755rm
Memoize/-0755rm
Module/-0755rm
Net/-0755rm
overload/-0755rm
Pod/-0755rm
pod/-0755rm
Search/-0755rm
Term/-0755rm
Text/-0755rm
Thread/-0755rm
Tie/-0755rm
Time/-0755rm
Unicode/-0755rm
unicore/-0755rm
URI/-0755rm
User/-0755rm
vendor_perl/-0755rm
warnings/-0755rm
AnyDBM_File.pm26180644editdlrm
AutoLoader.pm157970644editdlrm
AutoSplit.pm196370644editdlrm
autouse.pm42380644editdlrm
base.pm109610644editdlrm
Benchmark.pm310260644editdlrm
blib.pm20620644editdlrm
bytes.pm37400644editdlrm
bytes_heavy.pl7580644editdlrm
charnames.pm209310644editdlrm
CORE.pod31880644editdlrm
DB.pm189220644editdlrm
DBM_Filter.pm143850644editdlrm
deprecate.pm46030644editdlrm
diagnostics.pm192990644editdlrm
DirHandle.pm20850644editdlrm
Dumpvalue.pm176680644editdlrm
dumpvar.pl155550644editdlrm
English.pm47610644editdlrm
feature.pm190030644editdlrm
fields.pm94750644editdlrm
FileCache.pm55490644editdlrm
FileHandle.pm67840644editdlrm
filetest.pm40030644editdlrm
FindBin.pm45610644editdlrm
if.pm36110644editdlrm
integer.pm32540644editdlrm
Internals.pod25750644editdlrm
less.pm32040644editdlrm
locale.pm48550644editdlrm
Memoize.pm361920644editdlrm
meta_notation.pm21170644editdlrm
NEXT.pm189850644editdlrm
open.pm85120644editdlrm
overload.pm533020644editdlrm
overloading.pm18080644editdlrm
perl5db.pl3170940644editdlrm
PerlIO.pm144410644editdlrm
Safe.pm253640644editdlrm
SelectSaver.pm10760644editdlrm
SelfLoader.pm176860644editdlrm
sigtrap.pm87360644editdlrm
sort.pm39110644editdlrm
strict.pm47380644editdlrm
subs.pm9010644editdlrm
Symbol.pm47990644editdlrm
Test.pm300420644editdlrm
Thread.pm82890644editdlrm
UNIVERSAL.pm65940644editdlrm
URI.pm349540644editdlrm
utf8.pm104230644editdlrm
vars.pm24580644editdlrm
vmsish.pm43130644editdlrm
warnings.pm505370644editdlrm
XSLoader.pm112520644editdlrm
_charnames.pm341510644editdlrm
Edit: /usr/share/perl5/sort.pm (3911B)
package sort; our $VERSION = '2.04'; # The hints for pp_sort are now stored in $^H{sort}; older versions # of perl used the global variable $sort::hints. -- rjh 2005-12-19 $sort::stable_bit = 0x00000100; $sort::unstable_bit = 0x00000200; use strict; sub import { shift; if (@_ == 0) { require Carp; Carp::croak("sort pragma requires arguments"); } local $_; $^H{sort} //= 0; while ($_ = shift(@_)) { if ($_ eq 'stable') { $^H{sort} |= $sort::stable_bit; $^H{sort} &= ~$sort::unstable_bit; } elsif ($_ eq 'defaults') { $^H{sort} = 0; } else { require Carp; Carp::croak("sort: unknown subpragma '$_'"); } } } sub unimport { shift; if (@_ == 0) { require Carp; Carp::croak("sort pragma requires arguments"); } local $_; no warnings 'uninitialized'; # bitops would warn while ($_ = shift(@_)) { if ($_ eq 'stable') { $^H{sort} &= ~$sort::stable_bit; $^H{sort} |= $sort::unstable_bit; } else { require Carp; Carp::croak("sort: unknown subpragma '$_'"); } } } sub current { my @sort; if ($^H{sort}) { push @sort, 'stable' if $^H{sort} & $sort::stable_bit; } join(' ', @sort); } 1; __END__ =head1 NAME sort - perl pragma to control sort() behaviour =head1 SYNOPSIS use sort 'stable'; # guarantee stability use sort 'defaults'; # revert to default behavior no sort 'stable'; # stability not important my $current; BEGIN { $current = sort::current(); # identify prevailing pragmata } =head1 DESCRIPTION With the C pragma you can control the behaviour of the builtin C function. A stable sort means that for records that compare equal, the original input ordering is preserved. Stability will matter only if elements that compare equal can be distinguished in some other way. That means that simple numerical and lexical sorts do not profit from stability, since equal elements are indistinguishable. However, with a comparison such as { substr($a, 0, 3) cmp substr($b, 0, 3) } stability might matter because elements that compare equal on the first 3 characters may be distinguished based on subsequent characters. Whether sorting is stable by default is an accident of implementation that can change (and has changed) between Perl versions. If stability is important, be sure to say so with a use sort 'stable'; The C pragma doesn't I what follows, it just leaves the choice open. Thus, after no sort 'stable'; sorting may happen to be stable anyway. =head1 CAVEATS As of Perl 5.10, this pragma is lexically scoped and takes effect at compile time. In earlier versions its effect was global and took effect at run-time; the documentation suggested using C to change the behaviour: { eval 'no sort "stable"'; # stability not wanted print sort::current . "\n"; @a = sort @b; eval 'use sort "defaults"'; # clean up, for others } { eval 'use sort qw(defaults stable)'; # force stability print sort::current . "\n"; @c = sort @d; eval 'use sort "defaults"'; # clean up, for others } Such code no longer has the desired effect, for two reasons. Firstly, the use of C means that the sorting algorithm is not changed until runtime, by which time it's too late to have any effect. Secondly, C is also called at run-time, when in fact the compile-time value of C is the one that matters. So now this code would be written: { no sort "stable"; # stability not wanted my $current; BEGIN { $current = sort::current; } print "$current\n"; @a = sort @b; # Pragmas go out of scope at the end of the block } { use sort qw(defaults stable); # force stability my $current; BEGIN { $current = sort::current; } print "$current\n"; @c = sort @d; } =cut