#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11163431 use warnings; my @what_lines; @ARGV = '3raindeermaze.pl'; # FIXME while( <> ) { for ( split // ) { /\{/ ? push @what_lines, $. : /\}/ ? pop @what_lines : 0; } } print "line numbers with unmatched { => @what_lines\n";