[svn r8003] fix fucking qm script AGAIN

This commit is contained in:
expo
2008-08-06 13:20:35 +02:00
parent dde18d6740
commit c0ccf197ab

View File

@@ -92,7 +92,8 @@ while (<CSV>) {
if (!$ref) { $ref = ""; }
if (!$grade) { $grade = ""; }
if (!$desc) { $desc = ""; }
# hacked in by DL, as was acting weirdly due to uninitialized variables
if (!$area) { $area = ""; }
print "number $number, grade $grade, area $area, desc $desc, ref $ref, station $station, completion $completion\n";
if (($completion ne "") and ($ref ne ""))
{
@@ -177,25 +178,13 @@ print "\nInformation: Done\n";
# Parse the CSV file
sub parse_csv {
my $line = $_[0];
my @parsedline = ();
my $field = '';
while ($line =~ m{ \G(?:^|,)
(?: "((?> [^"]*) (?> "" [^"]*)*)" | ([^",]*)) }gx) {
if ($2) {
$field = $2;
} elsif ($1) {
$field = $1;
$field =~ s/""/"/g;
} else {
$field = '';
my @fields=split /\t/;
my @unquoted=();
foreach $_ (@fields) {
$_ =~ s/\"//g;
push (@unquoted, $_);
}
push(@parsedline, $field);
}
return(@parsedline);
return @unquoted;
}
# Usage