here you have a variable to which you apply a series of substitutions, (incidentally it is customary to write
when you have a long series of of substitutions - much cleaner IMHO).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; }
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |