Appreciate help with this, I want the file modified and correctly printed... appreciate your help. - open (SCR, "scratch.dat") || &CgiDie ("SCRATCH could not be opened while attempting read");
-
@scra =<SCR>;
-
close (SCR);
-
$reps = 1;
-
while ($reps < 19)
-
{
-
foreach $mine (@scra)
-
{
-
chomp($mine);
-
($the_line, $country_number) = split (/\|/, $mine);
-
open (CNT, "+>country.dat") || &CgiDie ("Country list could not be opened trying to position creatures");
-
@ymca =<CNT>;
-
foreach $thine (@ymca)
-
{
-
chomp($thine);
-
($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
-
$reps++;
-
} # End of for each @scra - scratch
-
-
close (CNT);
-
} # End of while
-
#unlink ("scratch.dat");
-
&printout;
-
}
-
else
-
{
-
&signin;
-
}
3 1252
You really need to please provide more information. You have fed us a script but have not described what you are seeing that is wrong. What is the input? What do you expect for output into the new file? You have to give us as much information as you can to help us help you.
Regards,
Jeff
My apologies. scratch.dat has 18 lines and each line is:
junk (line number) |country number. Country.dat is over 300 lines. For each loop, I want to read each line of scratch.dat and match the country number in country.dat which is $ln. When the right line of country.dat is found, I then want
to change $mn of country dat to equal $the_line of the scratch file. When all 18
changes are done, I need to write country.dat back with the changes made.
As a side note, I am reading the forum replies and tips. I realize I am needing to change my script to use warnings and strict. Only reason I havent here is I am having to rewrite the whole script and getting this to write the file
back is bugging me. This is only a fraction of that script. I have tried writing it back to country.dat and gotten crazy results. I am not attacking it right.
We are not able to help you, unless you provide more information.
We can't run the script to see what you mean with "crazy" results, because
1.) we don't have the files scratch.dat and country.dat.
2.) the script is incomplete.
So why don't you provide samle data? (not all 300 lines, 3 carefully chosen ones are enough!)
Show us the "crazy" results. And important, tell us what output you expected instead.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: lawrence |
last post by:
2 Questions:
1.) Can anyone think of a way to speed up this function? It is
terribly slow. I plan to reduce the number of directories to 3, which
I guess will speed it up in the end.
2.) This...
|
by: Aubrey Hutchison |
last post by:
Using Python 2,3,2 with idle for developing programs
about 200 lines long. - Problem is not common to any specific program.
Program are rather simple with no trick programming. Usually no classes...
|
by: Lowell Kirsh |
last post by:
I have a script which I use to find all duplicates of files within a
given directory and all its subdirectories. It seems like it's longer
than it needs to be but I can't figure out how to shorten...
|
by: scottyman |
last post by:
I can't make this script work properly. I've gone as far as I can with
it and the rest is out of my ability. I can do some html editing but
I'm lost in the Java world. The script at the bottom of...
|
by: Terry Hancock |
last post by:
I still run into my own ignorance a lot with unicode in Python.
Is it possible to define some combination of __repr__, __str__,
and/or __unicode__ so that the unicode() wrapper isn't necessary...
|
by: itdaddy |
last post by:
hey perl gurus!
i am new to this forum cause i need help. I have done many scripts.
but i want to use perl to do this:
What I want to do is this. I have a QRP file that I can convert to a txt...
|
by: Studiotyphoon |
last post by:
Hi,
I have report which I need to print 3 times, but would like to have
the following headings
Customer Copy - Print 1
Accounts Copy - Print 2
File Copy -Print 3
I created a macro to...
|
by: dmorand |
last post by:
When I try to print a 'print version' of my page it looks fine in IE 7, but when I print in IE 6 the margins are all screwed up. The page itself looks the same in both browsers, it's just when I...
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Many websites have a form or a link you can use to download a file. You click a form button or click...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |