in reply to grep confusion

Something like

print grep { $DetailSheet{ColumnName}{$_}{XlsColumn} == 2 } keys %{$DetailSheet{ColumnName}} ?

(Untested)

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

update

Added ColumnName level

Replies are listed 'Best First'.
Re^2: grep confusion
by BillKSmith (Monsignor) on Sep 01, 2017 at 13:58 UTC
    The function first_value (from List::MoreUtils) is slightly better than grep because it returns the single value that you expect as a scalar.
    use strict; use warnings; use List::MoreUtils qw(first_value); my(%DetailSheet) = ( ... ); my %Column = %{$DetailSheet{ColumnName}}; my $description = first_value {$Column{$_}{XlsColumn} == 2} keys %Colu +mn; print $description, "\n";
    Bill
      IMHO it's unclear from the OP s description how many results he expects.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

      I will need to look into that Bill, I'm always looking for shortcuts !

      I tried re-inventing the wheel again, but everytime I push it, it still falls flat on it's side...
Re^2: grep confusion
by PriNet (Monk) on Sep 01, 2017 at 02:13 UTC
    Hmmm... 'Error: Not a HASH reference'
    but I see where your going...

    I tried re-inventing the wheel again, but everytime I push it, it still falls flat on it's side...
        'Experimental keys on scalar is now forbidden'
        Let me see if I can add the %{...} and fix that...

        I tried re-inventing the wheel again, but everytime I push it, it still falls flat on it's side...
      wait... let me try that

      I tried re-inventing the wheel again, but everytime I push it, it still falls flat on it's side...