2011-04-01 48 views

回答

2
my($first) = $Fifo[5] =~ /T0int(\S+)/; 
my($second) = $Fifo[6] =~ /T0int(\S+)/; 

if (defined($first) && defined($second) && $first ne $second)) { ⋯ } 

以上的傲慢:傲慢

if (($Fifo[5] =~ /T0int(\S+)/)[0] ne ($Fifo[6] =~ /T0int(\S+)/)[0]) { ⋯ } 

甚至更​​多仍然:

if ((my($first, $second) = "@Fifo[5,6]" =~ /T0int(\S+)/g) 
     && $first && $second 
     && $first ne $second) 
{ 
    ⋯ 
} 
0

嘗試這樣:

if(($Fifo[5] =~ (/T0int(\S+)/)) && ($Fifo[6] =~ (/T0int(\S+)/)) && ($1 ne $2)) 

各地正則表達式基本上把括號將它們分組爲$ 1,$ 2

+1

** APRIL愚蠢!** – tchrist 2011-04-01 22:20:17

相關問題