Show us some sample data that fails and some test code. If the problem is real you shouldn't need more than a few lines of data and a few lines of code to reproduce the problem.
Are you sure the pattern you want to match is at the start of the line? Could it be that you are reading the entire file into a string and are then trying to match against that string? If so you probably need to use the m (multiple line match) switch. Consider:
use strict;
use warnings;
my $str = <<TEXT;
First line
1234X
last line
TEXT
print "Matched\n" if $str =~ /^\d{4,4}[A-Z0-9]$/;
print "Multi-matched\n" if $str =~ /^\d{4,4}[A-Z0-9]$/m;
prints:
Multi-matched
True laziness is hard work
|