in reply to Sort list by position of items in another list
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; my @pchr = qw( K Q R B N P ); my $w1 = 'QRKPNBQ'; # <- Q is repeated! my $w2 = join "", map $_ x (() = $w1 =~ /$_/g), @pchr; say "$w1 \-> $w2";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sort list by position of items in another list
by gflohr (Acolyte) on Feb 18, 2022 at 18:19 UTC |