Chris Nandor wrote: >#!perl -w >$anim = MacPerl::Pick('What kind?', 'Buffalo', 'Elk'); >$spec = MacPerl::Pick('What kind?', > 'Bull', 'Cow', 'Bull Calf', 'Heifer Calf', > '1 YR Old Bull', '1 YR Old Heifer', > '2 YR Old Bull', '2 YR Old Heifer' >); > >@anim = ('Buffalo', 'Elk'); >%anim = ('Buffalo' => 'BUF', 'Elk' => 'ELK'); >@spec = ( > 'Bull', 'Cow', 'Bull Calf', 'Heifer Calf', > '1 YR Old Bull', '1 YR Old Heifer', > '2 YR Old Bull', '2 YR Old Heifer' >); >%spec = ( > 'Bull' => 'BULL', 'Cow' => 'COWS', 'Bull Calf' => 'BCAV', > 'Heifer Calf' => 'HCAV', '1 YR Old Bull' => '1YRB', > '1 YR Old Heifer' => '1YRH', '2 YR Old Bull'=> '2YRB', > '2 YR Old Heifer' => '2YRH' >); > >print $anim{$anim} . $spec{$spec}; "Variations sur le mme thme" as we said in french... :-) In the following example, you'll be able to add or modify entries in the %anims and %specs associative arrays without changing the processing code each time. The keys are extracted and sorted for the dialog by a "sort keys %hash". #!perl -w my %anims = ( 'Buffalo' => 'BUF', 'Elk' => 'ELK', ); my %specs = ( 'Bull' => 'BULL', 'Cow' => 'COWS', 'Bull Calf' => 'BCAV', 'Heifer Calf' => 'HCAV', '1 YR Old Bull' => '1YRB', '1 YR Old Heifer' => '1YRH', '2 YR Old Bull' => '2YRB', '2 YR Old Heifer' => '2YRH' ); my $anim = MacPerl::Pick("What kind?", sort keys %anims); my $spec = MacPerl::Pick("What kind?", sort keys %specs); my $aa = $anims{$anim}; my $bb = $specs{$spec}; print "$aa$bb"; The last three lines could even be written as : print "$anims{$anim}$specs{$spec}"; +-----------------------------------------------------------------------+ Georges Martin <mailto:georges.martin@deboeck.be> +-----------------------------------------------------------------------+ Groupe De Boeck s.a. phone +32 10 48.25.72 Fond Jean Paques 4 fax +32 10 48.25.19 B-1348 Louvain-la-Neuve (Belgium) +-----------------------------------------------------------------------+ ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch