in reply to convert letters into a number
Given the desire expressed elsewhere to "group planes which have similar names" you may find the following helps:
use warnings; use strict; my @aircraft = qw(AD3 DAL13 DAL14 DBR2 DBR4 DBR3 DEHA2 FG3 FG6); my %byGroup; push @{$byGroup{$_->[1]}}, $_->[0] for map {[/(([A-Z]+).*)/]} @aircraf +t; printf "Group %5s: %s\n", $_, "@{$byGroup{$_}}" for sort keys %byGroup +;
Prints:
Group AD: AD3 Group DAL: DAL13 DAL14 Group DBR: DBR2 DBR4 DBR3 Group DEHA: DEHA2 Group FG: FG3 FG6
|
|---|