Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
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??

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";'

In reply to OK... I am confused and lost :( Editing FlatFile by LostS

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (8)
    As of 2014-09-22 10:15 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (188 votes), past polls