Hello everyone. I've tried several times to use associative arrays in my Perl scripts, but each time I have got syntax errors I can't understand. Based on the tutorials I've read I have tried to do things like this:
sub test_function {
my($key, %table); %table = ('word1', 'Perl', 'word2', 'is', 'word3', 'great'); $key = "word3";
print $table('word1');
print $table("word2");
print $table($key);
}
Each syntax used above produces a compile error and I can't work out the correct useage. Could someone tell me what I'm doing wrong? Any help appriciated.
Steven.