A doubt in using Class::Struct

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!


I am trying to use Class::Struct, for creating a structure as follows:

package Classes;
use Class::Struct;
struct(messages => '@');

$msg = new Classes;
push(@abc, "HELLO");
push(@abc, "WORLD");
push(@abc, "BYE");

@xyz = @;
foreach $elem(@xyz)
     print $elem ."\n";

This gives the following error on compilation:

Too many args to messages at (eval 1) line 17
        Classes::messages('Classes=ARRAY(0x8103084)', 'HELLO', 'WORLD',

Also, if I remove the third element of the array, the program compiles,
but I get the following output:

The element "HELLO is not displayed.
Can anyone help me with this or let me know what the problem is?


Site Timeline