相关疑难解决方法(0)

Perl变量声明中$,@,%之间有什么区别?

例:

my $some_variable;
my @some_variable;
my %some_variable;
Run Code Online (Sandbox Code Playgroud)

我知道,@似乎是为了数组,$对于原始,它是完全正确的吗?什么是%

syntax perl declaration

18
推荐指数
4
解决办法
3万
查看次数

4
推荐指数
1
解决办法
763
查看次数

Perl中"@"和"$"之间的区别

Perl @variable$variablePerl 之间有什么区别?

我已经在变量名称之前读取了符号$和符号的代码@.

例如:

$info = "Caine:Michael:Actor:14, Leafy Drive";
@personal = split(/:/, $info);
Run Code Online (Sandbox Code Playgroud)

什么是包含变量之间的区别$,而不是@

perl

4
推荐指数
2
解决办法
7286
查看次数

Perl中的数组问题

我是Perl的新手,在Perl中使用数组有些困难.有人可以向我解释为什么我无法在下面的脚本中打印数组的值.

$sum=();
$min = 999;
$LogEntry = '';
foreach $item (1, 2, 3, 4, 5)
{
  $min = $item if $min > $item;
  if ($LogEntry eq '') {
    push(@sum,"1"); }
    print "debugging the IF condition\n";
}
print "Array is: $sum\n";
print "Min = $min\n";
Run Code Online (Sandbox Code Playgroud)

我得到的输出是:

debugging the IF condition
debugging the IF condition
debugging the IF condition
debugging the IF condition
debugging the IF condition
Array is:
Min = 1
Run Code Online (Sandbox Code Playgroud)

我不应该Array is: 1 1 1 1 1(5次).有人可以帮忙吗?谢谢.

arrays perl

2
推荐指数
3
解决办法
243
查看次数

标签 统计

perl ×4

arrays ×1

data-structures ×1

declaration ×1

reference ×1

syntax ×1