
Yuvraj
Deleted
Nov 23, 2000, 7:26 PM
Post #1 of 2
(429 views)
|
|
About file handling
|
Can't Post
|
|
Hi, I have a file which contains some words (one word in one line).I want to read it's contents and do some pattern matching. But the problem here is when i read the file like @list=<handle>; the array list has all the words but a carriage return along with it.I used chop function then also a lot of error. open(han,"f1.txt"); @list=<han>; $i=0; while($i<=$#list) { if("word"=~ /$list[$i]/) { print "right"; } } the f1.txt contains contents in this format letter word sentence paragraph Will you please help me to solve this problem.The main problem is that i can't compare the strings.It may be due to the format in which the array stores the file contents. Thank you in advance
|