my $bros= {'1958' => [], '1959' => [], '1960' => [], '1961' => [],
'1962' => [], '1963' => [], '1964' => []};
since I was lazy and wanted to pre-build my data structure.
Here's the Data::Dumper listing of before and after the grep:
before grep:
$VAR1 = \[
{
'state' => 'OR',
'last' => 'Bertelson',
'first' => 'Gordon',
},
{
'state' => '',
'last' => 'Blaise',
'first' => 'Larry',
},
{
'state' => 'OR',
'last' => 'Douda',
'first' => 'Henry B.',
},
{
'state' => 'NSW 221',
' => 'Australia',
'last' => 'McHolick',
'first' => 'Dwane',
},
{
'state' => 'OR',
'last' => 'Murray',
'first' => 'Melvin',
},
{
'state' => 'OR',
'last' => 'Perry',
'first' => 'Larry',
},
{
'state' => '',
'last' => 'Peterson',
'first' => 'Ken',
},
{
'state' => 'OR',
'last' => 'Rianda',
'first' => 'Dave',
},
{
'state' => 'OR',
'last' => 'Steffanoff',
'first' => 'Nick',
},
{
'state' => 'CA',
'last' => 'Turner',
'first' => 'Paul',
},
{
'state' => 'OR',
'last' => 'Wilson',
'first' => 'Dick',
},
{}
];
after grep:
$VAR1 = \[
{
'state' => 'OR',
'last' => 'Bertelson',
'first' => 'Gordon',
},
{
'state' => '',
'last' => 'Blaise',
'first' => 'Larry',
},
{
'state' => 'OR',
'last' => 'Douda',
'first' => 'Henry B.',
},
{
'state' => 'NSW 221',
'last' => 'McHolick',
'first' => 'Dwane',
},
{
'state' => 'OR',
'last' => 'Murray',
'first' => 'Melvin',
},
{
'state' => 'OR',
'last' => 'Perry',
'first' => 'Larry',
},
{
'state' => '',
'last' => 'Peterson',
'first' => 'Ken',
},
{
'state' => 'OR',
'last' => 'Rianda',
'first' => 'Dave',
},
{
'state' => 'OR',
'last' => 'Steffanoff',
'first' => 'Nick',
},
{
'state' => 'OR',
'last' => 'Wilson',
'first' => 'Dick',
},
{} <- here's the empty hash
];
so you can see exactly what I'm saying by there's an empty hash where Paul Turner's information was.
As far as removing the element, I thought using the negative grep would find everything that didn't match what I wanted and put it in the array. I thought I was on the right track with the negative grep but I don't understand the empty hash in the array still being there.
My assumption is that grep is choking for whatever reason on that empty hash, so is a negative grep the way to go here?
Useless trivia: In the 2004 Las Vegas phone book there are approximately 28 pages of ads for massage, but almost 200 for lawyers.
|