in reply to Re: Return a value
in thread Return a value
I have written below code to read the each section of .ini file and its working perfect. I have to use below subroutine in my main file, I want to call it and pass the each value in each section into the hash over there and do the database operations. below is code:[Section1] SQL1=select * from <tablename> SQL2=insert into table <table name>
When I call this subroutine from main file, I don't get any return value which I could use for further database operations ( I want those SQL queries in hash so I could pass them to insert into my database using another program)sub Read_INI_files_get_initialData { my ( %ini_file, $ini_sect ); tie %ini_file, 'IniFiles',( -file => "/home/testtool/config/Initia +lData.ini" ); for $ini_sect ( keys %ini_file ) { %$ini_sect = %{ $ini_file{$ini_sect} }; } print "$Section1{SQL1}\n"; # output prints the 1st SQL1 statement + return in .ini file. return (\%Section1); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Return a value
by Corion (Patriarch) on Jul 06, 2015 at 10:29 UTC | |
by bhushanQA (Sexton) on Jul 06, 2015 at 10:32 UTC | |
by 1nickt (Canon) on Jul 06, 2015 at 11:13 UTC | |
|