my $debug = 1; .... print "Current record is: $recno and used flag is $used\n" if $debug;