I have an array with an array in it. It looks like:
@test =(
'mobilephone' => ['sony', 'htc'],
'pc' => ['dell', 'apple']
);
How can I print out the inner array?
I have ‘mobilephone’ and if the check variable is == ‘mobilephone’, so I want to print out sony and htc. How? Or is there another mistake by me?
@testis wrong. You are declaring a hash.Always use
use strict; use warnings;at the beginning of your script. You will be able to detect many errors!$test{key}will give you the corresponding array reference: