Simple Pointer question

08/10/2008 - 11:45 von Kilian | Report spam
Hi,

I have the following (perhaps very easy) question:

The following code gives the right output for @b if I use
Data::Dumper:
my @a, @b;

push (@a, {
id => 1,
whatever => 'true',
});


push (@a, {
id => 2,
whatever => 'false',
});

push (@b, {
test => 0,
myarray => [@a],
} );


I have the following question:

1. why it isn't allowed to write "myarray => @a"? If I use this
instead I get no failure but a totally wrong array.
2. How to access the variable myarray in @b do determine it's length,
sorting by id, etc...? I tried all possibilities with "scalar" and "@b-

{myarray}", "@b{myarray} and so on.



Thanks in advance,
Kilian.
 

Lesen sie die antworten

#1 Alexander Dahl
08/10/2008 - 13:10 | Warnen spam
Hi Killian,

I have the following (perhaps very easy) question:



You posted an english question to a german newsgroup. Please ask in
german here or give it a try on comp.lang.perl.misc

Greets
Alex

Ähnliche fragen