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
My current code is looking like this.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
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 advanceIn reply to hasing and arrays issue by perlDevsWorld
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |