in reply to reading an input file
Here's an (untested) implementation of what I think you want:
my ($section, $code, %passwds); while (<>) { chomp; if (/^\[(.*?)\]$/) { $section = $1; next; } if ($section eq 'CODE') { $code = $_; } elsif ($section eq 'PASS') { my ($name,$pass) = split; $passwds{$name} = $pass; } }
This actually makes a hash to map the names to passwords rather than creating a bunch of scalars. There's other ways you could do it too.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: reading an input file
by Anonymous Monk on Jan 22, 2004 at 23:17 UTC | |
by duff (Parson) on Jan 23, 2004 at 03:46 UTC | |
|
Re: Re: reading an input file
by ysth (Canon) on Jan 23, 2004 at 05:18 UTC |