{ # block to limit the effect of local local $/ = "\narea="; <$fh>; # read until the first "\narea="; } # here we are back to reading until the end of the line if (not eof $fh) # if the end of the file hasn't been reached while trying to find "area=" { $hash{$dir}{area} = <$fh>; # read the rest of the line }