in reply to Re: Bug in Sort::Fields?
in thread Split(), Initial Spaces, & a limit?
ikegami-
I'm sorry, but I don't believe I understand your point. It seems that all you did to fix the problem was to remove the initial spaces in the original data.
In my opinion Sort::Fields should sort the data the same way, regardless of where the data is (field 1 or field 2). If you try to numerically sort the output of an 'ls -s' command, you can see the problem clearly:
This doesn't do what is intended, and is why I made the report to the author. I'm sure I could remove the initial spaces for Data::Dumper, then put them back after it's done, but that doesn't seem right to me.use strict; use warnings; use Sort::Fields; use Data::Dumper; my @data = `ls -s`; chomp(@data); my @sorted = fieldsort( ['1n'], @data); print(Dumper(\@sorted));
-Craig
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Bug in Sort::Fields?
by ikegami (Patriarch) on Jul 20, 2010 at 19:02 UTC | |
by cmv (Chaplain) on Jul 20, 2010 at 19:14 UTC | |
by ikegami (Patriarch) on Jul 20, 2010 at 19:17 UTC | |
by ikegami (Patriarch) on Jul 20, 2010 at 19:28 UTC | |
by cmv (Chaplain) on Jul 20, 2010 at 19:41 UTC | |
by ikegami (Patriarch) on Jul 20, 2010 at 19:54 UTC | |
|
In Section
Seekers of Perl Wisdom