On Fri, Jul 24, 2009 at 11:01, Jo for lists and
groups wrote:
> How about this? Jo
>
>
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> my @list = qw/dog is a there/;
> my @sortOrder = (3,1,2,0);
> my @sorted;
> foreach (@sortOrder) { push(@sorted,$list[$_]); }
>
> print "@sorted";
> exit;
s
Steve Bertrand wrote:
> Jo for lists and groups wrote:
>> How about this? Jo
>
>> #!/usr/bin/perl
>>
>> use strict;
>> use warnings;
>>
>> my @list = qw/dog is a there/;
>> my @sortOrder = (3,1,2,0);
>> my @sorted;
>> foreach (@sortOrder) { push(@sorted,$list[$_]); }
>>
>> print "@sorted";
>> exit
Jo for lists and groups wrote:
> How about this? Jo
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> my @list = qw/dog is a there/;
> my @sortOrder = (3,1,2,0);
> my @sorted;
> foreach (@sortOrder) { push(@sorted,$list[$_]); }
>
> print "@sorted";
> exit;
...or this:
#!/usr/bin/perl
use
How about this? Jo
#!/usr/bin/perl
use strict;
use warnings;
my @list = qw/dog is a there/;
my @sortOrder = (3,1,2,0);
my @sorted;
foreach (@sortOrder) { push(@sorted,$list[$_]); }
print "@sorted";
exit;
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands
On Fri, Jul 24, 2009 at 00:14, sys adm wrote:
> Hi,
>
> When I got a word list, I want it to be sorted with special order.
> for example, I got this array:
>
> ("dog","is","a","there");
>
> I want the sorted result is:
>
> ("there","is","a","dog");
>
> How to code it? Thank you.
snip
You need to s
Hi,
When I got a word list, I want it to be sorted with special order.
for example, I got this array:
("dog","is","a","there");
I want the sorted result is:
("there","is","a","dog");
How to code it? Thank you.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands,
[sorry, PINE has become very confused about who said what]
On Oct 3, Jay Savage said:
On 10/3/05, Bakken, Luke <[EMAIL PROTECTED]> wrote:
JupiterHost.Net wrote:
>> On Oct 3, JupiterHost.Net said:
>>
>>> I have a list of strings that start with an uppercase B, Q, or Z
>>>
>>> I need to sort them
Bakken, Luke wrote:
> JupiterHost.Net wrote:
>>>On Oct 3, JupiterHost.Net said:
>>>
I have a list of strings that start with an uppercase B, Q, or Z
I need to sort them so they are in order of Q, B , then Z
Any ideas or input on how to efficiently do that with sort() or even
>
On 10/3/05, Bakken, Luke <[EMAIL PROTECTED]> wrote:
> JupiterHost.Net wrote:
> >> On Oct 3, JupiterHost.Net said:
> >>
> >>> I have a list of strings that start with an uppercase B, Q, or Z
> >>>
> >>> I need to sort them so they are in order of Q, B , then Z
> >>>
> >>> Any ideas or input on how t
JupiterHost.Net wrote:
>> On Oct 3, JupiterHost.Net said:
>>
>>> I have a list of strings that start with an uppercase B, Q, or Z
>>>
>>> I need to sort them so they are in order of Q, B , then Z
>>>
>>> Any ideas or input on how to efficiently do that with sort() or even
>>> map() is most appre
On Oct 3, Xavier Noria said:
On Oct 3, 2005, at 18:16, Jeff 'japhy' Pinyan wrote:
my @sorted =
map { tr/123/QBZ/; $_ }
sort
map { tr/QBZ/123/; $_ }
@data;
There's a potential gotcha there: since all Qs and Bs are being swapped
lexicographic order after the first character
On Oct 3, JupiterHost.Net said:
I have a list of strings that start with an uppercase B, Q, or Z
I need to sort them so they are in order of Q, B , then Z
Any ideas or input on how to efficiently do that with sort() or even
map() is most appreciated :) perldoc -f sort|-f map didn't appear to
On Oct 3, 2005, at 18:16, Jeff 'japhy' Pinyan wrote:
On Oct 3, JupiterHost.Net said:
I have a list of strings that start with an uppercase B, Q, or Z
I need to sort them so they are in order of Q, B , then Z
Any ideas or input on how to efficiently do that with sort() or
even map() is mos
On Oct 3, JupiterHost.Net said:
I have a list of strings that start with an uppercase B, Q, or Z
I need to sort them so they are in order of Q, B , then Z
Any ideas or input on how to efficiently do that with sort() or even map() is
most appreciated :) perldoc -f sort|-f map didn't appear to
On Oct 3, 2005, at 17:35, JupiterHost.Net wrote:
I need to sort them so they are in order of Q, B , then Z
The real array will have between 1 to 100 items, just FYI
They all go in ASCII relative order except B <-> Q, thus a way to get
it is to handle that special case and delegate to cmp
Howdy List :)
I have a list of strings that start with an uppercase B, Q, or Z
I need to sort them so they are in order of Q, B , then Z
my @sample_strings = qw(Bang Quiet Zing Zop Quid Boo);
I need them to be sorted as:
Quid
Quiet
Bang
Boo
Zing
Zop
I'd like to sort() them but can't f
16 matches
Mail list logo