Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Sort list by position of items in another list

by salva (Canon)
on Feb 18, 2022 at 18:30 UTC ( [id://11141478]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $pchr = "KQRBNP";
    my $w1 = "QRKPNBNBQRK";
    ...
    eval "\$w2 =~ y/\Q$ascii\E/\Q$pchr\E/";
    
    print "$w1 --[$pchr]--> $w2\n"
    
  2. or download this
    sub mk_sort {
        my $pchr = shift;
    ...
    my $w2 = $sort->($w1);
    
    print "$w1 --> $w2\n"
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11141478]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-20 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found