My updated code works for single inputs and for all but planning to extend this functionality by accepting comma seperated values. Need help with this. Thanks in advance!

host(); my $it=1; my %appHash=(); if($it == 1){ open(INPUTFILE,"<Services.conf")or die("unable to Services fiel"); while (<INPUTFILE>) { chomp; push @svcArray, (split /:/, $_, 3)[2]; } 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 choose a number from the list above: "; chop($input=<STDIN>); $input=trim($input); print " The input after chopping:$input\n"; } my $appCmnStr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><env:Envelo +pe xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"> <env:Body> <oos:req xmlns:oos=\"http: +//www.ecomm.com\">; send_svc($input); exit(0); ################# sub send_svc{ my @aArray; if(@_[0] && (lc @_[0] ne 'z')){ @aArray = (@_[0]); }else{ @aArray= (1 .. $size); } foreach $svcObjNum (@aArray){ if($appHash{$svcObjNum}){ $appsStr = $appsStr."<oos:obj class=\"$appHash{$svcObjNum}"/>"; } }

from here I concatenate the XML lines and make a post to service. All working well for single input or z which is for all. But need some assistance how can I achieve this for multiple input values comma or space separated. With the fact that need to from those XML lines based on the options users select and then post it to my service

On console it looks like below option

1. Recruitment 2. Payments 3. Retail 4. Legal z. all Please choose a number from the list above:

In reply to Re^2: hashing and arrays issue by perlDevsWorld
in thread 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.