local $/ = ''; # read paragraphs while (<>) { # each paragraph is multiple lines, the first of which is "Table: ..." # and the second is some kind of tag enclosed in brackets. my( $table ) = /^Table: (.*)/ or die "Hm... bad paragraph:\n$_"; my( undef, $tag, @lines ) = split /\n/; if ( $tag eq '[Alias]' ) { push @aliases, \@lines; } }