Hi All I'm running into issue while reading and splittling the content to assign the hash and array. I picked this concept so that I can print to the console and ask the users to select services with a # and then based on option will call the options and they can select all options too by entering all.

List of Services ================== HR:1453:Recruitment:Up FS:2355:Payments:Down RS:4555:Retail:Up LD:682111:Legal:Up

That is the file content I should read and print with options something like below

Services List: ============== 1. Recruitment::Up 2. Payments:Down 3. Retail::Up 4. Legal::Up Please enter the # to call the service: Enter A for all the services
My current code is looking like this.
host(); my $it=1; my %appHash=(); if($it == 1){ open(INPUTFILE,"<Services.conf")or die("unable to Services fiel"); while (<INPUTFILE>) { chomp; my $svsc = $_; @svcArray= split(/:/,$svsc); } close (INPUTFILE); foreach my $svc (@svcArray){ $appHash{it} = $svc; print "\n\t\t\t$it. $appHash{$it}\n"; $size = $it; $it++; } print "\n"; print "\t\t\tA for All \n"; print "Please enter # for the service you're trying to call:"); chop($input=<STDIN>); $input=trim($input);# I've function written for taking the spaces of i +nput print " The input after chopping:$input\n"; }

I'd need to send the strings like Payments for example if user enter #2. I'll assign it to some temp variable...

But this is not working it is taking everything off the list i.e.services.conf file and just printing List of Services

Hasing and array concept looks great but need assistance to get this through. Thanks so much in advance

In reply to hasing and arrays issue by perlDevsWorld

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.