in reply to Looping structure

The problem is line 17, that "else" at line 17 has nothing to match, all the brackets before that line matched perfectly.

Had you well indented your code, you probably figured out this yourself:

if ( exists $list{$location} ) { my $value = $list{$location}; $value++; $list{$location} = $value; } elsif ( $list{$location} eq "" ) { if ( exists $list{Unknown} ) { my $value = $list{Unknown}; $value++; $list{Unknown} = $value; } } else { $list{Unknown} = "1"; } =document else { $list{$location} = "1"; }

How to fix? it really depends on what you want, and I don't want to second guess.

By looking at the exsiting code, the logic looks broken. I don't think it will ever run into that elsif branch. If $list{$location} eq "", obviously exists($list{$location}).