Hello jb60606,
When I run your code on my 32-bit Vista system:
This is perl 5, version 18, subversion 1 (v5.18.1) built for MSWin32-x
+86-multi-thread-64int
I get the same results as you. Looking through the code, nothing leaps out as a potential trigger for different behaviour on a different system. (Did you ask the interviewer for details of the system on which he ran your code?) So I can’t help you there, sorry. But the following points should be noted:
Commenting-out use warnings; is a red flag. For lines with fewer than 26 fields, $array[25] is undefined, raising a warning on the equality test. One way to avoid the warning is to test for definedness first, and short-circuit if the value is undefined:
...
next if defined $sym8 && $symbol eq $sym8;
...
As Lennotoecom has pointed out, your results do not take account of symbol A in the data file. This is because the character class used in the call to split doesn’t include =. Note also that within a character class, the dot does not need to be escaped, and enclosing the space in double quotes merely adds the " character to the class. You should use: my @array = split /[. =]/, $line;.
If the files get bigger, the inefficiency of opening and closing and reopening the data file for each symbol in the symbol file will quickly become prohibitive. I would read the symbols into a hash an array first, then open the data file once and process it line by line, testing each symbol against the current line before moving on to the next.
Hope that helps,