phantom85 has asked for the wisdom of the Perl Monks concerning the following question:
Array:
Hash:completed_courses = [ { 'type' => 'core', 'name' => 'Discrete Structures', 'title' => 'CS 130' }, { 'type' => 'core', 'name' => 'Intro to Computer Science', 'title' => 'CS 140' }, { 'type' => 'core', 'name' => 'C++ Programming', 'title' => 'CS 256' } ];
I want to compare and remove the entry from schedule if the title in completed courses is same to Course in schedule. So after comparing the schedule should look like this.schedule = { 'CS 130 Section 01' => { 'Course' => 'CS 130', 'Time' => '8:00 AM - 9:00 AM', 'Class number => 35465, 'Room' => 8 302' }, 'CS 140 Section 01' => { 'Course' => 'CS 140', 'Time' => '8:00 AM - 9:00 AM', 'Class number => 35465, 'Room' => 8 302' }, 'CS 256 Section 01' => { 'Course' => 'CS 256', 'Time' => '8:00 AM - 9:00 AM', 'Class number => 35465, 'Room' => 8 302' }, 'CS 241 Section 02' => { 'Course' => 'CS 241', 'Time' => '8:00 AM - 9:00 AM', 'Class number => 35465, 'Room' => 8 302' }, }
Any ideas on how to achieve that would be appreciated thank you.schedule = { 'CS 241 Section 02' => { 'Course' => 'CS 241', 'Time' => '8:00 AM - 9:00 AM', 'Class number => 35465, 'Room' => 8 302' }, }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: comparing hash
by kcott (Archbishop) on Nov 06, 2016 at 23:47 UTC | |
|
Re: comparing hash
by stevieb (Canon) on Nov 06, 2016 at 23:48 UTC |