LostS has asked for the wisdom of the Perl Monks concerning the following question:
Hey Everyone Again
OK I have this script where a user can update an entry however when I do the modify the record it doesn't work... Here is my code... Can someone help??
What is happened is it is reading each entry but when it writes it writes the same line as many times as there are entries... All of them being the entry I edited :(
-----------------------
Billy S.
Slinar Hardtail - Guildless
Datal Ephialtes - Guildless
RallosZek.Net Admin/WebMaster
Aerynth.Net Admin/WebMaster
OK I have this script where a user can update an entry however when I do the modify the record it doesn't work... Here is my code... Can someone help??
open (DBASE,"$hrdata/$qfile"); @ODB=<DBASE>; close (DBASE); open (DATABASE,">$hrdata/$qfile"); foreach $rec (@ODB){ chomp($rec); ($oldpositionid,$oldinstitution,$olddepartment,$oldconfirstname,$oldc +onlastname,$oldconemail,$oldconphone,$oldtitleposition,$oldposnumber, +$oldtypeposition,$oldprogramtype,$olddvmonth,$olddvday,$olddvyear,$ol +dedmonth,$oldedday,$oldedyear,$oldnumposition,$oldnumvacunit,$oldtots +alary,$oldbudgetsalary,$oldstatefundsources,$oldfedfundsources,$oldst +atebudgetcat,$oldpriclass,$oldsubip,$oldthetime,$oldapproved) = split +(/\t/,$rec); if ($oldpositionid != $viewpositionid) { print DATABASE "$oldpositionid\t$oldinstitution\t$olddepartment\t$ol +dconfirstname\t$oldconlastname\t$oldconemail\t$oldconphone\t$oldtitle +position\t$oldposnumber\t$oldtypeposition\t$oldprogramtype\t$olddvmon +th\t$olddvday\t$olddvyear\t$oldedmonth\t$oldedday\t$oldedyear\t$oldnu +mposition\t$oldnumvacunit\t$oldtotsalary\t$oldbudgetsalary\t$oldstate +fundsources\t$oldfedfundsources\t$oldstatebudgetcat\t$oldpriclass\t$o +ldsubip\t$oldthetime\t$oldapproved\n"; } else { print DATABASE "$viewpositionid\t$institution\t$department\t$confirs +tname\t$conlastname\t$conemail\t$conphone\t$titleposition\t$posnumber +\t$typeposition\t$programtype\t$dvmonth\t$dvday\t$dvyear\t$edmonth\t$ +edday\t$edyear\t$numposition\t$numvacunit\t$totsalary\t$budgetsalary\ +t$statefundsources\t$fedfundsources\t$statebudgetcat\t$priclass\t$ENV +{REMOTE_ADDR}\t$thetime\tNo\n"; } } close (DATABASE);
What is happened is it is reading each entry but when it writes it writes the same line as many times as there are entries... All of them being the entry I edited :(
-----------------------
Billy S.
Slinar Hardtail - Guildless
Datal Ephialtes - Guildless
RallosZek.Net Admin/WebMaster
Aerynth.Net Admin/WebMaster
perl -e '$cat = "cat"; if ($cat =~ /\143\x61\x74/) { print "Its a cat! +\n"; } else { print "Thats a dog\n"; } print "\n";'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: OK... I am confused and lost :( Editing FlatFile
by runrig (Abbot) on Aug 27, 2001 at 22:41 UTC | |
by LostS (Friar) on Aug 27, 2001 at 22:50 UTC | |
Re (tilly) 1: OK... I am confused and lost :( Editing FlatFile
by tilly (Archbishop) on Aug 28, 2001 at 21:14 UTC |
Back to
Seekers of Perl Wisdom