[問題] foreach if in one line
請問有無可能將foreach和if判斷式寫在同一行呢?
原始語意:
foreach (@arr){
dosomething if expr;
}
我試了
dosomething if expr foreach @arr;
{dosomething if expr} foreach @arr;
可是都失敗..
請問還有其他方法將if和foreach合併在一行嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.46.31
推
05/12 17:53, , 1F
05/12 17:53, 1F
→
05/12 17:59, , 2F
05/12 17:59, 2F
推
05/12 19:17, , 3F
05/12 19:17, 3F
→
05/12 21:48, , 4F
05/12 21:48, 4F
→
05/12 21:49, , 5F
05/12 21:49, 5F
→
05/12 21:51, , 6F
05/12 21:51, 6F
推
05/12 22:13, , 7F
05/12 22:13, 7F
推
05/13 00:33, , 8F
05/13 00:33, 8F
→
05/13 00:59, , 9F
05/13 00:59, 9F
→
05/13 00:59, , 10F
05/13 00:59, 10F
推
05/13 04:53, , 11F
05/13 04:53, 11F
推
05/13 05:19, , 12F
05/13 05:19, 12F
推
05/13 05:23, , 13F
05/13 05:23, 13F
→
05/13 17:12, , 14F
05/13 17:12, 14F
→
05/13 20:22, , 15F
05/13 20:22, 15F
→
05/13 20:22, , 16F
05/13 20:22, 16F
推
05/13 21:04, , 17F
05/13 21:04, 17F
推
05/13 21:28, , 18F
05/13 21:28, 18F
→
05/13 21:34, , 19F
05/13 21:34, 19F
推
05/13 23:22, , 20F
05/13 23:22, 20F
推
05/16 18:40, , 21F
05/16 18:40, 21F
討論串 (同標題文章)
以下文章回應了本文 (最舊先):
完整討論串 (本文為第 1 之 3 篇):
Perl 近期熱門文章
PTT數位生活區 即時熱門文章