मुझे कुछ अतिरिक्त कार्यक्षमता जोड़ने के लिए कुछ मौजूदा कोड को संशोधित करने के लिए कहा गया था। मैंने Google पर खोज की है और मुझे जवाब नहीं मिल रहा है। मैं इस आशय के लिए कुछ है ...पर्ल में सबराउटिन के लिए तर्क के रूप में हैश का उपयोग कैसे कर सकता हूं?
%first_hash = gen_first_hash();
%second_hash = gen_second_hash();
do_stuff_with_hashes(%first_hash, %second_hash);
sub do_stuff_with_hashes
{
my %first_hash = shift;
my %second_hash = shift;
# do stuff with the hashes
}
मैं निम्नलिखित त्रुटियाँ हो रही है:
Odd number of elements in hash assignment at ./gen.pl line 85.
Odd number of elements in hash assignment at ./gen.pl line 86.
Use of uninitialized value in concatenation (.) or string at ./gen.pl line 124.
Use of uninitialized value in concatenation (.) or string at ./gen.pl line 143.
लाइन 85 और 86 उप दिनचर्या में पहले दो लाइनें हैं और 124 और 143 हैं, जहां मैं हैश का उपयोग कर रहा हूँ। जब मैं उन त्रुटियों को देखता हूं तो ऐसा लगता है कि मेरे हैंश अनियमित हैं। हालांकि, मैं सत्यापित कर सकता हूं कि हैंश के पास मूल्य हैं। मुझे इन त्रुटियों को क्यों मिल रहा है?
यह डुप्लिकेट है। कृपया http://stackoverflow.com/questions/944784/ – innaM