"John W. Krahn" wrote: > > Perhaps this will do what you want: > > #!perl -w > use strict; > use Data::Dumper; > > open RD, 'input.txt' or die "Cannot open 'input.txt' $!"; > > my ( %data, $temp ); > while ( <DATA> ) { > chomp; > my ( $name, $value ) = split /\s*=\s*/ or next; > if ( exists $temp->{ $name } or eof DATA ) {
Oops, forgot a line. :-) $temp->{ $name } = $value if eof DATA; > $data{ $temp->{ port } } = $temp; > $temp = { $name, $value }; > next; > } > $temp->{ $name } = $value; > } > > print Dumper \%data; > > __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>