in reply to Iterative Subroutine Approach Question
That way, you're just inserting all the parts and descriptions, and all you do is change your description whenever you hit a SYSTEM row. If you need more information than just a description, you can use a hash structure instead of a scalar, but the concept is the same.my $current_description; foreach $row (@rows) { if ($row is a 'SYSTEM' row) { $current_description = (description from 2 rows above); } if ($row is a part number) { insert into database ($part_number, $current_description) } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Iterative Subroutine Approach Question
by finhagen (Sexton) on Mar 12, 2009 at 22:22 UTC | |
by bellaire (Hermit) on Mar 13, 2009 at 00:29 UTC | |
by finhagen (Sexton) on Mar 13, 2009 at 02:58 UTC |