foreach my $c (qw(col_endow col_gfund col_restr col_total)) { if ( substr($key,0,3) eq "010" || substr($key,0,3) eq "023" || substr($key,0,3) eq "025" || substr($key,0,3) eq "027" || substr($key,0,3) eq "030" || substr($key,0,3) eq "043" || substr($key,0,3) eq "045" || substr($key,0,3) eq "066" || substr($key,0,3) eq "097" ) { $row_data{num_style} = 'style="vnd.ms-excel.numberformat:$* #### use List::MoreUtils qw(any); my @specials = qw(010 023 025 027 030 043 045 066 097); foreach my $c (qw(col_endow col_gfund col_restr col_total)) if (any { substr($key,0,3) eq $_ } @specials) { $row_data{num_style} = .....