Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
There's more than one way to do things
 
PerlMonks  

Re: Sort::Key::Radix::skeysort bug or user error?

by Anonymous Monk
on Apr 16, 2012 at 08:50 UTC ( #965256=note: print w/ replies, xml ) Need Help??


in reply to Sort::Key::Radix::skeysort bug or user error?

But I get a bunch of errors:

:) Well, the code you posted doesn't use warning, so I don't see how you're getting those warnings :)

#!/usr/bin/perl -- use strict; use warnings; my @magma = qw/ 39CE7A132F3CF 1E739E84CBCF3 339E84CBCF3C7 39CF4265E79E3 2739E84CBCF3C 339E84CBCF3C7 273D09979E78F 1CE7A132F3CF1 39E739E84CBCF 33CE73D09979E 3CE73D09979E7 279CE7A132F3C 339CF4265E79E 0E73D09979E78 /; use Sort::Key::Radix qw/ skeysort /; my @sortedIdx = skeysort { my $what = $_; warn "WHAT $what "; $what = $magma[$_] if not length $_ > length scalar @magma; return $what; } 0 .. $#magma ; use Data::Dump qw/ dd /; dd \@magma ; dd \@sortedIdx ; dd @magma[@sortedIdx]; __END__ $ perl what WHAT 0 at what line 23. WHAT 1 at what line 23. WHAT 2 at what line 23. WHAT 3 at what line 23. WHAT 4 at what line 23. WHAT 5 at what line 23. WHAT 6 at what line 23. WHAT 7 at what line 23. WHAT 8 at what line 23. WHAT 9 at what line 23. WHAT 10 at what line 23. WHAT 11 at what line 23. WHAT 12 at what line 23. WHAT 13 at what line 23. WHAT 39CE7A132F3CF at what line 23. WHAT 1E739E84CBCF3 at what line 23. WHAT 339E84CBCF3C7 at what line 23. WHAT 39CF4265E79E3 at what line 23. WHAT 2739E84CBCF3C at what line 23. WHAT 339E84CBCF3C7 at what line 23. WHAT 273D09979E78F at what line 23. WHAT 1CE7A132F3CF1 at what line 23. WHAT 39E739E84CBCF at what line 23. WHAT 33CE73D09979E at what line 23. WHAT 3CE73D09979E7 at what line 23. WHAT 279CE7A132F3C at what line 23. WHAT 339CF4265E79E at what line 23. WHAT 0E73D09979E78 at what line 23. [ "39CE7A132F3CF", "1E739E84CBCF3", "339E84CBCF3C7", "39CF4265E79E3", "2739E84CBCF3C", "339E84CBCF3C7", "273D09979E78F", "1CE7A132F3CF1", "39E739E84CBCF", "33CE73D09979E", "3CE73D09979E7", "279CE7A132F3C", "339CF4265E79E", "0E73D09979E78", ] [13, 7, 1, 4, 6, 11, 12, 2, 5, 9, 0, 3, 8, 10] ( "0E73D09979E78", "1CE7A132F3CF1", "1E739E84CBCF3", "2739E84CBCF3C", "273D09979E78F", "279CE7A132F3C", "339CF4265E79E", "339E84CBCF3C7", "339E84CBCF3C7", "33CE73D09979E", "39CE7A132F3CF", "39CF4265E79E3", "39E739E84CBCF", "3CE73D09979E7", )

Apparently, on the first pass, $_ is the index, but subsequently it is the actual value --- the module interface doesn't exactly make sense to me, but if it really is faster ...


Comment on Re: Sort::Key::Radix::skeysort bug or user error?
Download Code
Re^2: Sort::Key::Radix::skeysort bug or user error?
by Happy-the-monk (Monsignor) on Apr 16, 2012 at 09:53 UTC

    the code you posted doesn't use warning, so I don't see how you're getting those warnings :)

    most probably by calling it with perl -w ... from outside the programme.

    Cheers, Sören

      most probably missing the gentle criticism, Cheers, Sören

      Yes, it was a subtle criticism about not providing Short, Self Contained, Correct Example. Yes, it was an effective question (all the parts were there), but you couldn't copy/paste/run the code and see the error, you had to add all the missing parts first

Re^2: Sort::Key::Radix::skeysort bug or user error?
by traceyfreitas (Sexton) on Apr 16, 2012 at 18:07 UTC
    Thank you for digging in to it! What I posted was actually just a few snippets. Doesn't everyone automatically use strict & warnings?? ;^)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2014-04-21 12:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (495 votes), past polls