One further note of caution. If you use while(chomp($a = <>)), then your loop will not process the last line of the file if it is incomplete (i.e. if it is missing the final newline). It is common on DOS and Windows for the last line to be incomplete.
It is safer to put the chomp inside the body of the loop.