# File: datastr2.pl # Data Structures in Perl: Associative List (%) # Associative list is a list of pairs (key - value) # Mihaela Malita # >perl datastr2.pl # Days are: 1Mon2Tu3Wed4Th # Keys are 1 2 3 4 # Values are Mon Tu Wed Th # Find in the associative array the coressponding value for key 2: Tu %Days = ( 1 , 'Mon', 2 , 'Tu', 3 , 'Wed', 4 , 'Th' ); print "Days are: ", %Days; @Mykeys = keys %Days; print "\nKeys are @Mykeys \n"; @Myval = values %Days; print "Values are @Myval \n"; print "Find in the associative array the coressponding value for key 2: "; print $Days{2}; exit;