Read a char from a file (PERL)
Hello everyone !
I am trying to read from a textfile a charachter one bye one and then write it to another file. I am trying to figure it out using perl. I did it in pascal , which looks like Var ch:char; . . . BEGIN . . . assign(input1,input2); reset(input1); assign(output1,output2); rewrite(output1); While not eof( INPUT1 ) do begin while not eoln( INPUT1 ) do begin read(input1,ch); write(output1,ch); end end close(input1);close(output1); . . . END In perl how do i work with only one charachter each time in the loop ?? How do i work with files in perl ?? in perl there arent the: "EOF" and "EOLN" commands to indicate the end of the file AND the end of the line. Is there sth simmilar ?? How do i built the above nested loop in perl ? Thx for your help ! |
|
thx for the help dude !
But is there any way , that i can read only one char each time ? |
Here is a way to access a file char by char :
Code:
# open the file |
Thx a lot man !
|
All times are GMT -5. The time now is 11:17 PM. |