I am writing a script for my two little boys to play a game. We
are not going to hack ourself so I am not doing strict etc. I mention
this because previous attempts to get help did not get the question
answered elsewhere,but referred to do strict and warnings. There is a ton more code than what I am going to show you...a re-write to strict would take a long time...not merited for a script for only use on a home system.
Scratch.dat is a dat file with 18 lines...
country.dat is also a dat file with 336 lines...
I want to read all 18 lines of scratch.dat and update country.dat
so that if scratch.dat (country_number) is equal to country.dat (ln),
then country.dat (mn) would be changed to the value of scratch.dat
(the_line)...I need help with printing the updated country.dat file
Please help me with this.
[code]# Have 18 rand numbers, now assign creatures to countrys
open (SCR, "scratch.dat") || &CgiDie ("SCRATCH could not be opened while attempting read"); @scra
$reps = 1;
while ($reps < 19)
foreach $mine (@scra
($the_line, $country_number) = split (/|/, $mine);
open (CNT, "+>country.dat") || &CgiDie ("Country list could not be opened trying to position creatures"); @ymca
foreach $thine (@ymca
($ln, $nm, $nr, $ne, $ea, $se, $so, $sw, $we, $nw, $mn, $tt ) = split (/|/, $thine);
if ($ln == $country_number)
$mn = $the_line;
} # End of for each on country file
} # End of for each @scra
} # End of while #unlink