If the line
if($filedata[$i] =~ m/../) did not match, it is highly likely
@filedata does not contain what you think it contains, or much of anything at all, since two periods matches any two characters (except in some cases a newline). Have you tried printing every line before the IF statement to make sure the data is actually in
@filedata as you expect?
The final regex you settled looks like it should work fine, by the way (although as halley noted may give you false positives).