in reply to Perl Program w/ Hash
Hash maintains the data as key-value pairs.
The data which is left to the operator '=>' is known as key.
And the data which is right to the operator '=>' is known as value.
Using keys you can get the value of a particular key in a hash in the following way.
$hash{'key'}
And keys should be unique.
In your case 'username' is a key and 'phone number' is a value.
So using username you can get the phone number of the user.
So,$friend{'username'} will give the phone number.
The data which is left to the operator '=>' is known as key.
And the data which is right to the operator '=>' is known as value.
Using keys you can get the value of a particular key in a hash in the following way.
$hash{'key'}
And keys should be unique.
In your case 'username' is a key and 'phone number' is a value.
So using username you can get the phone number of the user.
So,$friend{'username'} will give the phone number.
|
---|
In Section
Seekers of Perl Wisdom