in reply to Push into an array inside a array
Assuming that mean push a scalar onto an arrayref already contained within an array element, (as opposed to pushing an arrayref onto an array as the other respondents have demonstrated), then:
@a = ( [1, 2.3 ], ['a'..'c'], ['p'..'r']);; pp \@a;; [[1, "2.3"], ["a", "b", "c"], ["p", "q", "r"]] push @{ $a[ 1 ] }, 'a scalar';; pp \@a;; [[1, "2.3"], ["a", "b", "c", "a scalar"], ["p", "q", "r"]]
|
|---|