Hi Monks,
This is the first iteration of my thinking process to handle this issues, What I am trying to do is have format that prints values in an array with seperations but without repeating the the prefix of the sentence (I know the above words doesn't mean anything I tried my best to explain in words..)
This is what I really want to do,
The name William could be Willy, Will, Bill
So here is the code..
entire %nicknames is too big to put it here, I know you guys get the idea right ..
#hash table that contains nicknames %nicknames = ( Abe => 'Abraham', Abram => 'Abraham Abe', Bill => 'William Will', Will => 'Bill William willy', );
Part of my code which handles the above hash
=pod Idea is to match the nick name with the correct first name and return the correct name which matches with the user entered nick name. =cut sub matchNickname { my $nickTemp; foreach my $key(keys %nicknames) { my $value = $nicknames{$key}; if(lc $name eq lc $key){ print "user typed ".$name." Match the key ".$key." and val +ue is $value\n\n"; $nickTemp = $value; @nickArray = split '\W+', $nickTemp; foreach $nickTemp(@nickArray) { if($DEBUG){print "The name $name could be <$nickTemp> +or ";} } } #print "$key ==> $value\n"; #print "$nickTemp\n"; } #print "Value of nickTemp is $nickTemp\n"; }
In reply to Help on format or better way to do..? by learnperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |