【发布时间】:2009-09-27 03:23:11
【问题描述】:
我想我知道如何在 Perl 中使用列表,当这种情况发生时。如果我这样做(调试代码,不包括漂亮):
#! /usr/bin/perl -w
use strict;
my $temp1 = "FOOBAR";
my $temp2 = "BARFOO!";
my @list = { $temp1, $temp2 };
print $temp1; #this works fine
print $list[0]; #this prints out HASH(0x100a2d018)
看起来我正在打印第二个字符串的地址。如何获取存储在列表中的实际字符串?我认为它与参考有关,但不确定。
【问题讨论】:
标签: perl string list reference