On Mon, 11 Jul 2005 10:16:17 -0500
"Gomez, Juan" <[EMAIL PROTECTED]> wrote:


> I been hearing about hash on perl 
> can someone tell me a little bit about that and if you could add a
> example 
> it would be very nice from you thank you 



A hash is a set of relationships, for example

Item    Cost

Beans   300
Carrot  200
Apple   250


etc

To create this relationship in perl, use the hash notation

        %vegetable_costs  =     (Beans  => 300
                                Carrots => 200,
                                Apple   => 250 );

To refer to the hash, you use $vegetable_costs{Beans} for the cost of beans etc

for eaxample, your program might have a print statement like

print "The cost of beans is $vegetable_costs{Beans}\n";


If you understand that, try putting the words "perl hash" into Google.



Owen

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to