⭐ in reply to How do I read the contents of a file?
To read data from the file, just use the <> operator:use IO::File; $f = new IO::File "filename.txt", "r";
To close the file afterwards, simply undefine $f:while (<$f>) { ... do something here... }
undef $f;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Answer: How do I read the contents of a file?
by davido (Cardinal) on Sep 12, 2003 at 08:56 UTC | |
|
Re: Answer: How do I read the contents of a file?
by NetWallah (Canon) on Sep 12, 2003 at 21:03 UTC | |
|
Re: Answer: How do I read the contents of a file?
by ysth (Canon) on Nov 20, 2003 at 08:34 UTC |