in reply to reading a file, put into array. Missing first line
To you question. The first line was missed because you already read it at your while(<$fh>), which you didn't take care of it in the rest of your code.
Besides, since you read your handle like this : @2comp =<$fh> ( again, @2comp is invalid var name ), this will be considered as a wantarray mode, so the rest of lines in the handle will be read and put into your array, which make your while loop meaningless.
To correct this, you may either:
@data = <$fh>; ( without the while loop ) or push @data, $_ while (<$fh>);
|
|---|