Hi PerlMonks,

I am interested to access the data for a student using the query of Registration number. I have no idea about making a database. So I have thought of using the arrays to get the detailed information. Is it possible to get the desired results using arrays and hash as given in the following script (incomplete)? I request Perlmonks to provide some suggestions in this matter.

#!/usr/bin/perl use warnings; use strict; ################################# ## HASH OF ARRAYS: ################################# my @a=qw/A B C D/; my @b=qw/20 19 22 23/; my @c=qw/x1 x2 x3 x4/; my @d=qw/phone4 phone2 phone3 phone1/; my @e=qw/72 55 83 69/; my @f=qw/2011 2012 2009 2008/; # HASH of arrays: my %hash=('Name' => @a, 'Age' => @b, 'Regd_no' => @c, 'Phone_num'=> @d, 'Marks' => @e, 'Pass_year'=> @f); ## To access all the information with the query of Regd Number: print"\n Enter the regd number (say x3): "; my $entry=<STDIN>; ## Code for accessing individual student information ??? (Not known) ## Code for inserting & deleting the details of a student ??? exit;

Result should look like:

Regd No. x3 has the following details:

Name: C

Age : 22

Phone_num: phone3

Marks: 83

Pass_Year: 2009


In reply to How can one access all the details of a person using arrays & hash? by supriyoch_2008

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.