A
A. Farber
Hello,
I have an object representing a player:
sub new {
my $package = shift;
my $self = {
.......
CHAT => [[], [], []],
};
bless($self, $package);
}
and its CHAT member holds messages
from 3 other players in an array of 3 arrays.
Then I have a method which sends those
messages over a socket to the player:
$aref = $self->{CHAT}->[0];
push @response, 'chat0=' . join '', @$aref;
$self->{CHAT}->[0] = [];
The last line truncates the sub-array
(after the messages have been sent).
I wonder if I can truncate that array by
using the $aref ? Something like $#xxxx = -1;
Thank you
Alex
I have an object representing a player:
sub new {
my $package = shift;
my $self = {
.......
CHAT => [[], [], []],
};
bless($self, $package);
}
and its CHAT member holds messages
from 3 other players in an array of 3 arrays.
Then I have a method which sends those
messages over a socket to the player:
$aref = $self->{CHAT}->[0];
push @response, 'chat0=' . join '', @$aref;
$self->{CHAT}->[0] = [];
The last line truncates the sub-array
(after the messages have been sent).
I wonder if I can truncate that array by
using the $aref ? Something like $#xxxx = -1;
Thank you
Alex