in reply to read a few lines, put them into named variables
This aborts if we ever get less than five lines, and declares them all at once! Cool! For example, alternating lines of key/value pairs:{ defined($_ = <STDIN>) or last for my ($one, $two, $three, $four, $five); .. process all five lines .. redo; }
And if there's an odd number lines, we don't execute that code for that last line.{ defined($_ = <STDIN>) or last for my ($key, $value); $hash{$key} = $value; redo; }
-- Randal L. Schwartz, Perl hacker
|
|---|