in reply to Re^2: array matching problems
in thread array matching problems
The second for loop grap the array and join the words. To grap a entry use%h = ( '1' => [ 'hello', 'you', 'tree' ], '3' => [ 'sun', 'grass' ], '2' => [ 'people', 'fun' ], ... );
$num = 1; $string = join '', @{$h{$num}}; # string is now helloyoutree $num = 4; # select the string with number 4 ( lovefood ) $string = join '', @{$h{$num}};
|
|---|