作者sqrt1089 (李崩子)
看板Perl
標題[問題] 關於字串
時間Mon Sep 27 18:51:13 2010
假設我讀入一個檔案
lee David
wang steve
lee eric
wu hunry
.. ..
.. ..
.. ..
是個兩行的檔案,一行是姓,一行是名。
想要結果
輸入:lee
會印出:
David
eric
..
..
就是所以是lee的印出來
以下是我初步的程式:
open FILE, "c:aa.txt";
#print <FILE>;→這是測試是否有成功讀取檔案
chomp(my$a=<>);
..
..
print"";
close FILE;
中間我卡了快一個禮拜整個沒頭緒,駱駝書第14章有練習過,但還是不知道怎下手
(一直很想用find,但是perl似乎沒這指令.....)
--
--
▂▂ ▂▂▂
▂▄▅▅▄▆█ _█◣
◢ (●) ◣/\\
丫 │◥  ̄◤
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.215.116
推 dryman:就...用hash啊 09/27 19:01
推 dark22:array_search 不錯用... 09/27 22:20
→ kornelius:就算有 find 也不對呀... XD 09/28 01:25