hberven1 has asked for the wisdom of the Perl Monks concerning the following question:
Hello all, I'm having some difficulty reading a .csv file in Perl. I am trying to read a number of files containing data in specific columns where some of the columns contain superscript and some other interesting characters. For some reason Perl is not able to read them and just outputs them as a question mark with a black circle behind it. Below are the column headers giving me problems followed by the code I use to draw them out:
405nm Data: Nº of Objects(Nº)
405nm Data: Total 1º Area(µm²)
405nm: single cells: Mean 1º Area(µm²)
405nm: Sub G1: Nº of Objects(Nº)
405nm: Cell: Nº of Objects(Nº)
#!/usr/bin/perl use strict; my $sql; my $line; my @words; my $tag; open (FILE, "test.txt") || "Cannot open file: $!"; while ($line = <FILE>) { print $line; chomp $line; @words = split(/\t\s*/, $line); last; } foreach $tag (@words) { print $tag."\n"; }
Any help would be greatly appreciated!
thanks,
Haakon
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Odd symbols in read file function?
by jethro (Monsignor) on Jul 08, 2011 at 13:33 UTC | |
|
Re: Odd symbols in read file function?
by Tux (Canon) on Jul 08, 2011 at 14:04 UTC | |
|
Re: Odd symbols in read file function?
by Anonymous Monk on Jul 08, 2011 at 13:38 UTC |