in reply to While loop and LAST
The problem is that each continues from where it last returned unless you reset the iterator using (say) keys %hash. Which means that you are not searching the complete hash each time around your outer loop.
But, before you go fixing that; why are you searching a hash in the first place? That (as Mr.Wall would have it) is like "buying and Uzi and using it to club your enemy to death".
You should be able to just do:
foreach my $row ($te->rows) { $tracking_code = $ { $row }[0]; $job_title = $ { $row }[1]; $location = $ { $row }[2]; $date_posted = $ { $row }[3]; if( exists $job_categories{ $job_title } ) { $department = $job_categories{ $job_title }; } else { print "no match"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: While loop and LAST
by Kenosis (Priest) on Nov 02, 2013 at 06:19 UTC | |
by BrowserUk (Patriarch) on Nov 02, 2013 at 06:50 UTC | |
by mcoblentz (Scribe) on Nov 02, 2013 at 16:16 UTC |