hi,
try escaping the |
split ("\|", $line);
hope this works....
sgb.
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 25, 2002 6:04 PM
Subject: problems with split
hi,
i have a data file test1.txt as follows:
551356835||1|7684940|47534900|0
551356835||1|7684940|47534900|0
551356835||1|7684940|47534900|0
551356835||1|7684940|47534900|0
551356835||1|7684940|47534900|0
551356835||1|7684940|47534900|0
551356835||1|7684940|47534900|0
551356835||1|7684940|47534900|0
551356835||1|7684940|47534900|0
551356835||1|7684940|47534900|0
.......
my code should open test1.txt, read in the data, convert it an print it
into
test2.txt :
open(FILEONE, "test1.txt") or die "Could not open File: $!\n";
open(FILETWO, ">test2.txt") or die "Could not open File: $!\n";
while ($line = <FILEONE>) {
($nodeid, $nameid, $type, $longitude, $latitude, $altitude) = split
("|", $line);
print FILETWO "P|",$longitude, "|",$latitude,"||";
}
close FILEONE;
close FILETWO;
the result in rtest2.txt is:
P|3|5||
P|3|5||
.....
actually i expect this :
P|7684940|47534900||
P|7684940|47534900||
P|7684940|47534900||
P|7684940|47534900||
P|7684940|47534900||
P|7684940|47534900||
P|7684940|47534900||
P|7684940|47534900||
P|7684940|47534900||
P|7684940|47534900||
.....
hope sb can help me. thank you in advance!!!!
habi
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]