Join 300,358 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,924 people online right now. Registration is fast and FREE... Join Now!
runs fine for me (no errors or warnings) and prints "6", as expected. Or was there some other result that you wanted to produce?
ummm... looks like I am not begin able to visualize u my situation here,
I have configuration file where I have got array @CFG, And in my script I am reading that array(not using filehandle) and accessing elements of that array using following command, "$CFG::CFG[0]->{'CMD'}";
As In your script you are getting 6 out of this command print scalar @CFG, "\n";
I also want to find out the number of elements, But how? I tried following commands but non-workes,
I have configuration file where I have got array @CFG,
And in my script I am reading that array(not using filehandle) and accessing elements of that array using following command, "$CFG::CFG[0]->{'CMD'}";
As In your script you are getting 6 out of this command print scalar @CFG, "\n";
I also want to find out the number of elements, But how? I tried following commands but non-workes,
CODE
print scalar @CFG::CFG print scalar @CFG, "\n";
I guess I'm still not following you, because, if you can access $CFG::CFG[0], then you can access @CFG::CFG and "scalar @CFG::CFG" should tell you how many items are in that array.
Can you post a minimal (but complete/runnable) failing test case, including both a file demonstrating where @CFG is defined and one demonstrating how you're accessing it, along with what your desired output from the test case would be?
I have configuration file where I have got array @CFG,
And in my script I am reading that array(not using filehandle) and accessing elements of that array using following command, "$CFG::CFG[0]->{'CMD'}";
As In your script you are getting 6 out of this command print scalar @CFG, "\n";
I also want to find out the number of elements, But how? I tried following commands but non-workes,
CODE
print scalar @CFG::CFG print scalar @CFG, "\n";
I guess I'm still not following you, because, if you can access $CFG::CFG[0], then you can access @CFG::CFG and "scalar @CFG::CFG" should tell you how many items are in that array.
Can you post a minimal (but complete/runnable) failing test case, including both a file demonstrating where @CFG is defined and one demonstrating how you're accessing it, along with what your desired output from the test case would be?
Hi dsherohman, I got it working, there was some scripting error with my configuration file, Any way thanks!!!