in reply to Re^2: Need help with filling a complicated data structure
in thread Need help with filling a complicated data structure

Similar to ig's proposal below, I would collect the lines belonging to a list and then call a sub that processes the lines of the list.

... $tab++; my @list; for my $line (@{$section}) { my $line = convert_string($line, $line_magic); if( $line =~ /^[*#]+ / ) { push @list, $line; next; } else { process_list( @list ) if @list; @list = (); } line($tab, $line), next if $line =~ /^</; ...