[問題] perl的elsif問題

看板Perl作者 (hero)時間14年前 (2011/03/18 16:51), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
my $str='haha_foo_bar'; if($str =~ /haha.*foo.*bar/) { print "Match haha.*foo.*bar\n" } elsif($str =~ /haha.*bar/) { print "Match haha.*bar\n"; } else { print "Match .*bar\n"; } 代碼執行輸出 Match haha.*foo.*bar 但elsif那個為什麼沒執行呢﹖ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 147.243.236.28

03/18 17:17, , 1F
被 if () 拿去了就不會 elsif
03/18 17:17, 1F
文章代碼(AID): #1DWnpuDw (Perl)
文章代碼(AID): #1DWnpuDw (Perl)