Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the file with employees: name ID title age salary Group Peter 120 Mecha

ID: 3737987 • Letter: C

Question

Consider the file with employees:

name

ID

title

age

salary

Group

Peter

120

Mechanics

30

12000

Jo, George

Norbert

150

Librarian

23

11000

Ann, Eli

Kai

170

Gardener

35

10000

Mary, Terry

Please write a code in PERL that will do the following:

a. create a data type (record) that contains the six(6) data fields

b. print the record

c. store it

d. update the salary

e. scan the record according to their salary

f. print the data with sorting on age

name

ID

title

age

salary

Group

Peter

120

Mechanics

30

12000

Jo, George

Norbert

150

Librarian

23

11000

Ann, Eli

Kai

170

Gardener

35

10000

Mary, Terry

Explanation / Answer

1. creating employee record and insert entire data like this recordone,recordtwo etc.

        

2. printing record

    

              which prints name of first record data that is, peter

     print(%{$database{"recordone"}}->{"age"} . " ");

              which prints age of first record data that is, 30

3.   @database = ( %recordone, %recordtwo );

      it will store records recordone,recordtwo in database

4. $dbh is the database connector

it will update salary of employer with id 150 as 15000

5. Fetch each row and print it

6. sorting table and print

  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote