我是Perl的新手,对不起我的愚蠢问题.
我搜索了但是我没有找到办法做到这一点.
我创建了一个类,一个属性需要是一个对象列表,我需要稍后调用此列表.
我试图将列表中的对象推送到收到消息的列表中:
匿名哈希中奇数个元素...
我的包裹
package Squid;
use strict;
use warnings;
sub new
{
my $class = shift;
my $self = {@_ };
print "Creating new $class\n";
$self->{'filas'} = [];
bless ($self, $class);
return $self;
}
1;
Run Code Online (Sandbox Code Playgroud)
这是脚本:
use Squid;
use warnings;
use strict;
my $fila = FilaSquid->new("nome" => 'Fila 1', "profundidade" => 45);
my $fila2 = FilaSquid->new("nome" => 'Fila 2', "profundidade" => 7);
my $squid = Squid->new("versao" => '1.0', "origem" => 'C:\temp', "filas" => @filas);
print "\nA versao …Run Code Online (Sandbox Code Playgroud)