I'm having a hard time trying to make sense of what you may mean. Your code plainly won't work and IMHO it doesn't shed any light on what your real aim may be.

here you have a variable to which you apply a series of substitutions, (incidentally it is customary to write

for ($status) { s/P|F|C|D|I/Posted/g; s/A/Accepted/g; s/N/New/g; s/R/Rejected/g; s/S/Save/g; s/X/Canceled/g; }
when you have a long series of of substitutions - much cleaner IMHO).

Update: contrary to what I wrote above, in this particular case I'd probably do something along the lines of (untested):

my %subst={ A => 'Accepted', N => 'New', R => 'Rejected', S => 'Save', X => 'Canceled' }; $subst{$_}='Posted' for qw/P F C D I/; $status =~ s/[A-Z]/$subst{$&}||$&/ge;

Note to the update: I am aware of the gotchas about $& & C. My gut feeling is that people overestimate them. Personally I'm not a fanatic of its use, but happen to resort to it every now and again...

Then you create an array containing only (the value of) that variable and sort it, which is an immaterial operation, since it has only one entry in any case.


In reply to Re: Sorting Issue by blazar
in thread Sorting Issue by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.