my %ofInterest = map { $_ => 1 } qw[ perl.exe cmd.exe textpad.exe ]; #### my @fields = qw[ Name WorkingSetSize UserModeTime KernelModeTime ]; #### for my $info ( # This ^^^^^ var will be set to the hashref each of the ... grep{ exists $ProcsOfInterest{ lc $_->{ Name } } } @proc_info # ...............^^^^^^^^^^^^^^^^ processes of interest ) { # ........................and is used here vvvvv printf "%-25s %14d %12.6f %14.7f\n", @{ $info }{ @fields }; # .......................in a hash slice ^^ ^^ ^ # ............................with the field names ^^^^^^^ # ..to produce the wanted 4 values and supply them to printf } #### my @fields = qw[ Name WorkingSetSize UserModeTime KernelModeTime ]; ... printf ... @{ $info }{ @fields }; #### printf ... @{ $info }{'Name','WorkingSetSize','UserModeTime','KernelModeTime'}; #### printf ... $info->{ Name }, $info->{ WorkingSetSize }, $info->{ UserModeTime }, $info->{ KernelModeTime };