Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't find string terminator ' " ' anywhere before EOF at ... 1

Status
Not open for further replies.

CutCopy11

Programmer
Feb 19, 2009
1
US
For some reason, this code will not work. There are no unmatched quotes. Plus, if I intentionally make an error by placing a bare word or symbol anywhere in my code, this single error shows up:

Can't find string terminator ' " ' anywhere before EOF at ...


In this code, I am creating a new file.
1. I open a text file with three columns from $ARGV[0].
2. I create three hashes from this file.
3. I close this text file (optional?).
4. Then, I open an outgoing file.
5. I open the same text file with three columns from $ARGV[1].
6. I print stuff into the outgoing file.
7. I close the outgoing file and the text file.

#! /usr/bin/perl - w


$infile1 = $ARGV[0]; #
open ( INA, $infile1 );

while ($line = <INA>) {
@array = split " ", $line;
$x = $array[1];
$y = $array[2];
$temp = sprintf "%.1f_%.1f", $x, $y;
$temp2 = sprintf "%.1f_%.1f", $y, $x;
$coordinate_counter{$temp}++;
$coordinate_counter2{$temp2}++;
}
foreach $position (keys %coordinate_counter) {
if ($coordinate_counter{$position} < 10,000) {
$height{$position} = 1;
} elsif (($coordinate_counter{$position} >= 10,000) && ($coordinate_counter{$position} < 20,000)) {
$height{$position} = 2;
} elsif (($coordinate_counter{$position} >= 20,000) && ($coordinate_counter{$position} < 30,000)) {
$height{$position} = 3;
} elsif (($coordinate_counter{$position} >= 30,000) && ($coordinate_counter{$position} < 40,000)) {
$height{$position} = 4;
} elsif (($coordinate_counter{$position} >= 40,000) && ($coordinate_counter{$position} < 50,000)) {
$height{$position} = 5;
} elsif ($coordinate_counter{$position} > 50,000) {
$height{$position} = 6;
}

}
foreach $position2 (keys %coordinate_counter2) {
if ($coordinate_counter2{$position2} < 10,000) {\
$height2{$position2} = 1;
} elsif (($coordinate_counter2{$position2} >= 10,000) && ($coordinate_counter2{$position2} < 20,000)) {
$height2{$position2} = 2;
} elsif (($coordinate_counter2{$position2} >= 20,000) && ($coordinate_counter2{$position2} < 30,000)) {
$height2{$position2} = 3;
} elsif (($coordinate_counter2{$position2} >= 30,000) && ($coordinate_counter2{$position2} < 40,000)) {
$height2{$position2} = 4;
} elsif (($coordinate_counter2{$position2} >= 40,000) && ($coordinate_counter2{$position2} < 50,000)) {
$height2{$position2} = 5;
} elsif ($coordinate_counter2{$position2} > 50,000) {
$height2{$position2} = 6;
}
}

open(OUTGOING, ">wtro_vs_wvo_3d.txt" );
$infile2 = $ARGV[1];
open ( INB, $infile2 );

while ($line = <INB>) {
@array = split " ", $line;
$x = $array[1];
$y = $array[2];
$temp = sprintf "%.1f_%.1f", $x, $y;
$temp2 = sprintf "%.1f_%.1f", $y, $x;

print OUTGOING "$line $height{$temp} $height2{$temp2};
}
close( OUTGOING );
 
There are no unmatched quotes.

Unmatched quotes here:

Code:
  print OUTGOING [red]"[/red]$line    $height{$temp}    $height2{$temp2};




------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
If you use something like notepad++ you can easily find these kinds of issues. Also helps with matching up quotes and parans.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top