in reply to Re: How do you read the next line in a file while in a loop?
in thread How do you read the next line in a file while in a loop?
Nice answer, ++blakem! Let me make some small remarks - your code has slight differences to the specifications ...
and everything should be fine - as long as the option keywords are not allowed as values for any of the options.# at top of program my @options = qw/on except some more options/; my $opt_string = join '|', @options; my $opt_pattern = qr/^($opt_string)\s+/i; # instead of your line $curroption = $1 if s/$opt_pattern//;
while (my ($option, $val_ref) = each %options) { print "$option -- ", join (',',@$val_ref), "\n"; }
-- Hofmator
|
|---|