in reply to Re: Comparing Hash's key to an <STDIN> and print it's corresponding value
in thread Comparing Hash's key to an <STDIN> and print it's corresponding value
for a first reply, it's pretty much impressive how much I'm benefiting from these brain storming, in both, Perl and grammatical sense! :P
well, I was like "what if the person is he, then what if he is a she" then I thought of replacing it with an "it" for time saving purposes as my main concern was actually running the code! lol
I totally agree with what you just mentioned, because I've been in the situation of printing the number of elements there and not only once but in the same number as key-value pairs was there! after fixing it, I can understand the context concept you're talking about!
I understood it even more, from the latter example you proposed! loved how you made use of arrays to print the index of the key that has been entered by the user, and then printing it's value!
what's interesting even more in your code and might need a bit of elaboration, if you don't mind me, is that part when you invoke the retHashVal and both parameters are scalars, while in it's body you would use the array's default variable in assigning to $n and $i .. how things are working there? depending on context I'd say that @_ would be converted implicitly to a scalar, is this how it goes in this case?