in reply to Re: Sort array1 according to sorting of array2
in thread Sort array1 according to sorting of array2
No sorts. References are optional, of course.#!/usr/bin/perl use strict; use warnings; my @arr1 = qw(john:::10 bill:::9 mary:::35 willy:::21); my @arr2 = qw(9 35 10 21); my %hash = map { $_ =~ /:::(\d+)$/; ($1 => \$_); } @arr1; print for map { $$_ } @hash{@arr2};
|
|---|