supriyoch_2008 has asked for the wisdom of the Perl Monks concerning the following question:
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How can one access all the details of a person using arrays & hash?
by Athanasius (Archbishop) on Mar 17, 2013 at 07:28 UTC | |
by supriyoch_2008 (Monk) on Mar 17, 2013 at 07:37 UTC | |
Re: How can one access all the details of a person using arrays & hash?
by CountZero (Bishop) on Mar 17, 2013 at 08:54 UTC | |
Re: How can one access all the details of a person using arrays & hash?
by topher (Scribe) on Mar 17, 2013 at 07:31 UTC |
Back to
Seekers of Perl Wisdom