in reply to Shorten/simplify repetitive code

#!/usr/bin/perl use strict; use warnings; my %prefixes = map {$_ => 1} qw /APG CBR CLR CNY COD .../; my %array; # Holds @APG, @CBR, @CLR, etc. my %hash; # Holds %APGF, %CBRF, %CLRF, etc. while (<>) { chomp; s/ +//g; # Use of '+' is faster if there are consecutive spac +es. tr/a-z/A-Z/; # Or $_ = uc; if (/^(\w{3})/ && $prefixes {$1}) { my $name = $1; @{$array {$name}} = split /,"?|""?/; check $hash {"${name}F"}; # Is already a reference. } else { s/\W.*//; warn qq {$ARGV line $.: "$_" is not a valid APG command!\n"}; } }

Abigail