in reply to grep confusion
#!/usr/bin/perl -l # http://perlmonks.org/?node_id=1198481 use strict; use warnings; my %DetailSheet = ( 'ColumnName' => { 'ID' => { 'PositionAdjustment' => 0, 'RecordName' => 'Identification', 'RecordNumber' => 0, 'RecordValue' => '', 'XlsName' => 'Reference', 'XlsColumn' => 1, 'XlsFormat' => '', 'XlsWidth' => 15, 'XlsLock' => 1, 'GuiName' => 'Number', 'GuiNumber' => 2, 'GuiValue' => '', 'Switch' => [ ['O','0'], ['l','1'] ] }, 'DESCRIPTION' => { 'PositionAdjustment' => 0, 'RecordName' => 'Description', 'RecordNumber' => 1, 'RecordValue' => '', 'XlsName' => 'Description', 'XlsColumn' => 2, 'XlsFormat' => '', 'XlsWidth' => 15, 'XlsLock' => 1, 'GuiName' => 'Description', 'GuiNumber' => 3, 'GuiValue' => '', 'Switch' => [ [' AND ', ' & '], [' WITH ', ' W/ '] ] } } ); print grep { $DetailSheet{ColumnName}{$_}{XlsColumn} == 2 } keys %{ $DetailSheet{ColumnName} };
Outputs:
DESCRIPTION
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: grep confusion
by PriNet (Monk) on Sep 01, 2017 at 04:00 UTC | |
by LanX (Saint) on Sep 01, 2017 at 08:09 UTC | |
by PriNet (Monk) on Sep 03, 2017 at 00:20 UTC | |
by kcott (Archbishop) on Sep 04, 2017 at 01:22 UTC |