#!/usr/bin/perl -- use strict; use warnings; my $input = ; chomp $input; while () { if ((/#bg\s$input/ .. /#be\s$input/) =~ /^\d+(?