如果我在Perl循環中有2個if
循環,如果我的腳本進入我的第一個if
,如何跳過第二個if
?Perl - 如果在foreach循環中跳過秒
實施例:
my $var1 = 1;
my $var2 = 1;
for my $item ('...') {
if ($var1 == 1) {
print "First IF \n";
}
if ($var2 == 1) {
print "Second IF (I don't want this to be printed if the first if is true)\n";
}
}
請避免使用'$ a'和'$ b'變量,它們用於'sort'函數。 – Toto 2014-10-28 12:55:56
此外,它會很好地避免裸字當意義變量 – teodozjan 2014-10-28 14:09:30