in reply to Sorting Issue
What is unclear is where you get the list of data you have to sort. $status is a scalar, and according to Re^6: Sorting Issue it contains a single letter. What are you trying to sort? The only explaination I can give about this is that you get multiple values from somewhere, so you're not giving the cycle over which you're iterating. However, excercising some powers, we could guess something like this:
So, you have to declare @strings before the cycle, and push each $extended_status you get inside it to have the list you need to perform the sort. Otherwise... you know, sorting a one-element list does not make much sense :)my %subst ( P => 'Posted', F => 'Posted', C => 'Posted', D => 'Posted', I => 'Posted', A => 'Accepted', N => 'New', R => 'Rejected', S => 'Save', X => 'Canceled', ); my @strings; # Note: declared before while ($iteration_condition_is_true) { my $status = gets_some_value(); my $extended_status = $subst{$status}; # Add the string to the list push @strings, $extended_status; } my @sorted_strings = sort @strings;
Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf
|
|---|