Ask a Question

What is the ouput of the below perl code : print Content-type: text/html ; #HTTP HEADER #DEFINE SOME ARRAYS%coins = (Quarter, 25, Dime, 10, Nickle, 5);%ages = (Jerry, 45, Tom, 22, Vickie, 38); #PRINT MY HASHES TO THE BROWSERprint %coins;print ;print %ages;



A. Quarter 25Dime 10Nickle5 Jerry 45Vickie38Tom22
B. Dime 10Nickle5Quarter25 Jerry 45Vickie38Tom22
C. Quarter 25Dime10Nickle5 Tom22 Jerry45Vickie38
D. Error

This question is part of Perl Scripts assessment

+ Answer
...

Request Answers

2 Answers

ganapathy1995

Ganapathy1995

Answered on Nov 29, 2016

Actually, In hash we cannot sure or assume that, the hash will print like this only.
If array means we can sure that, it will print in the order. But in hash we cannot. Because while storing in the hash itself the order of insert will change. But the key and value cannot change.
For example:
While run first time,

Quarter25Nickle5Dime10
Vickie38Jerry45Tom22

While run in second time,

Dime10Nickle5Quarter25
Tom22Jerry45Vickie38

21centurians1

21centurians1

Answered on Nov 21, 2016

Dime10Nickle5Quarter25Jerry45Vickie38Tom22

Search for Google images
Upload from your computer
Search for Google images
Upload from your computer
Search for Google images
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.