A doubt in using Class::Struct
am 05.10.2006 20:33:13 von noneHello,
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");
$msg->messages(@abc);
@xyz = @{$msg->messages};
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',
'BYE')
Also, if I remove the third element of the array, the program compiles,
but I get the following output:
WORLD
The element "HELLO is not displayed.
Can anyone help me with this or let me know what the problem is?
Thanks,
Avi.