Thanks Graff, Sorry I didn't get a chance to reply for this, My Grandmother passed away and it has been a very emotional time since she had a major impact on my life.

Answer to your question which was "What am I trying to do here "
This is module that I am creating to work along with few other modules. And finally I am planning on running my perl script against the website to get the data. What I want to do here is, when the user enter a name analyze if there are nicknames for that name and get those nick names.
if the user enter name and if its a nick name lets say Will, it should give Willy, William as the results for "Will".
If the user enter "William" then it should give Willy, Will as the result.
Main Idea is to find multiple ways of representing name with the emphasize on nicknames. I dont have to put the spelling mistakes and other scenarios since I handle them in a different module.

So in mathematically I am thinking of a set theory implementation I am sorry I miss lead you in my original post.
the concept of the hash I am trying to have is,
A => B, C, D, E
B => A, C, D, E
C => A, B, D, E
D => A, B, C, E
E => A, B, C, D

I didn't put entire code since it has other subroutines that have no impact on this situation also I am new to perl so the code is 200 lines long. This is the entire code that I have which is related to the issue, sorry I should have put this before rather than putting a part of the code.

#!/usr/bin/perl use Text::Soundex; use WWW::Mechanize; #use MakeRegex; $DEBUG = true; $SOUNDEX = 0; print STDOUT "\nEnter name: "; $name = <STDIN>; chomp $name; =pod $result = ucfirst( $name ); $totalResult .= $result . " "; print ( "\n---------- Entered Name\n\n" ); print ($result); print ( "\n\n---------- Transposed Letters\n\n" ); $result = lc transposeName( $name ); $totalResult .= $result . " "; print ($result); calcSoundex( $result ); print ( "\n\n---------- Dropped Character\n\n" ); $result = lc dropCharName( $name ); $totalResult .= $result ." "; print ($result); calcSoundex( $result ); =cut #hash table that contains nicknames %nicknames = ( Abe => 'Abraham', Abram => 'Abraham Abe', Bill => 'William Will', Will => 'Bill William willy', Richard => 'Rick Dick Ric Ricky', Rick => 'Richard Dick Ricky', ); 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"; }
Thanks
LearnPerl

In reply to Re^4: Help on format or better way to do..? by learnperl
in thread Help on format or better way to do..? by learnperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.