Hello Wise Monks,
I come forth Seeking your Knowledge for the good of Humanity.
I need to get the values with a Single id "j" rather than many like 'i' either as CSV or space.
The only constrain I was given that I should
use only Config::IniFiles Predefined Method to get this and store it an array.
Not
REGEX or SPLIT FUNCTION or Any other third party Methods .
Please Help me with your Wise Knowledge.
This is my Code:
#! /usr/bin/perl
use warnings;
use strict;
use Getopt::Long;
use Config::IniFiles;
# SAMPLE : SET CONFIGURATION SAMPLE FILE TO READ.
my ($sample,%ini,$cfg,%input_config_citi);
GetOptions('config=s'=>\$sample);
# TIE : OBTAIN THE CONFIG FILES CONTETNS
$cfg= Config::IniFiles->new(-file=>$sample);
tie %ini,'Config::IniFiles', (-file=>$sample);
%input_config_citi=%{$ini{'hello'}};
#my @arr=$cfg->val('hello','i');
my @arr=$cfg->val('hello','j');
print "\n\nThe values are : \n\n";
print "$_\n",for(@arr);
This is my INI file.
Code:
#
#
#
#
#
#
[hello]
#
#
#
#
i=abc
i=def
i=ghi
i=jkl
i=mno
j=abc def ghi jkl mno pqrs tuv wxyz
Update
SOLUTION FOUND BY MYSELF:
ANSWER
Dont Mind the Morons Reply down below without Any Answers, Has got not answers Just some whining
I need to get the values with a Single id "j" rather than many like 'i' either as CSV or space.
Well Instead of CSV or spaces, I used an \n with EOT.
It is so clear.
How can you not Understand..??????????
If you Already knew the Answer..??
Then What were you Waiting For...???????????????????????
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.