perl - Retrieving array from array of arrays? -


use strict; @a; @b = (); @a = (3, 4);  push @b, [@a];  @c = @b[0]; print @c; 

how retrieve @c? tells me scalar value @b[0] better written $b[0].

(this isn't real code privacy reasons, in real code have this:

my @a = @{$b[$i]}; print @a; 

this says "use of uninitialized value," still prints it's supposed to.

if have array reference stored in $b[0] - situation - retrieve

$ref = $b[0]    # want reference 

or

@arr = @{$b[0]} # want (new) array 

or

$elt = $b[0][1] # want directly access second element $elt = $b[0]->[1] # alternative syntax, same thing. 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -