There are few lines where I don't agree:
my $column_separator = ",";
Better:
my $column_separator = qr/,/;
...imaging someone wants to use "." as separator.
my $column_number = "3";
Don't write numbers as text, write them as numbers (cut away those " chars).
Loading the whole file into memory might not be that good idea, imagine it's a 10 GB file. Why not parse it line-by-line?
open(FILE,"<","$file");
while (<FILE>) {
my @columns = split(/$column_separator/);
print $columns[$column_number],"\n";
}
close FILE;
|