my $tag = ""; while () { ($tag = $1, next) if /\{(\w+)\}/; print $_ if $tag eq "AUTHOR"; }