When you say "not working as expected", it would be helpful to say in particular how the actual result differed from the expected result.
In your list of four variations, are the initial digits ("1.", "2.", "3.", "4.") part of the data? If so, is there really variation in the data as to whether the initial period is followed by a space? (It would be better to provide four lines of "actual" data enclosed in code tags.)
I'd go with the suggestion above about using split - and I see no reason for that to be complicated:
#!/usr/bin/perl
use strict;
use warnings;
while (<DATA>) {
my @flds = split;
if ( $flds[0].$flds[1] eq 'N/AN/A' ) {
print "nana: $flds[2]\n";
}
elsif ( $flds[0] eq 'N/A' ) {
print "na1: $flds[2]\n";
}
elsif ( $flds[1] eq 'N/A' ) {
print "na2: $flds[2]\n";
}
else {
print "no na: $flds[2]\n";
}
}
__DATA__
1234 5678 no_nas_here blah blah
1234 N/A should_be_na2 blah blah
N/A 5678 must_be_na1 blah blah
N/A N/A nana
(It seems I may have initially posted an incorrect version of this snippet, and updated it to correct the errors.)