in reply to Filling In "The Gaps" in an Array
I'm not sure if I understood your post or your code, but I think this does what you wanted.
#!/usr/bin/perl -w use strict; my @IDS; my $last = [0,0,0,0,0]; # In case the first line has fields missing while (<DATA>) { my @temp = split/\t+/; # allow multiple tab seperators. # set this element from the last if it's null $temp[$_] eq '' and $temp[$_] = $last->[$_] for 0 .. $#temp; push @IDS, $last = \@temp; # push saving a reference } print "@{$_}" for @IDS; =pod output c:\test>219201 1234 5 20021201 1 0 5678 0 20021202 0 0 5678 0 0 0 10 9120 10 20021211 0 0 6543 5 20021202 0 0 6543 0 0 0 5 6543 0 0 0 5 =cut __END__ 1234 5 20021201 1 0 5678 0 20021202 0 0 0 0 0 10 9120 10 20021211 0 0 6543 5 20021202 0 0 0 0 0 5 0 0 0 5
Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Filling In "The Gaps" in an Array
by tall_man (Parson) on Dec 12, 2002 at 00:38 UTC | |
by Abigail-II (Bishop) on Dec 12, 2002 at 11:34 UTC | |
by BrowserUk (Patriarch) on Dec 12, 2002 at 01:30 UTC |