glwtta has asked for the wisdom of the Perl Monks concerning the following question:
I am doing something rather simple - iterating over the lines from <> and splitting each one into words. What I can't seem to figure out how to do, is grab the first two words from the first line, and then continue on as usual. In other words, I want to my $first_line = <>; my ($word1, $word2) = split /\s+/, $first_line; while(<>){...} but still have the rest of $first_line be processed in the wile(<>).
Am I missing something obvious?
(Oh, I wouldn't want to slurp the whole thing into RAM first, as the input can get rather largish)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: "uhshifting" the diamond?
by PodMaster (Abbot) on Oct 21, 2003 at 00:36 UTC | |
Re: "uhshifting" the diamond?
by pzbagel (Chaplain) on Oct 21, 2003 at 00:46 UTC | |
Re: "uhshifting" the diamond?
by Abigail-II (Bishop) on Oct 21, 2003 at 09:58 UTC | |
Re: "uhshifting" the diamond?
by Limbic~Region (Chancellor) on Oct 21, 2003 at 00:38 UTC | |
Re: "uhshifting" the diamond?
by delirium (Chaplain) on Oct 21, 2003 at 02:43 UTC |