One other thing that the others seemed not to pick up on, probably because the line does not seem to have any functionality in this program: my @cols = qw('data.txt'); You should not use quotes inside a qw(...) unless you actually want the quotes to be part of the data. qw will quote each item for you anyway.