-
June 23rd, 2005, 08:15 PM
#1
Openning and reading from file in Perl
Howdy guys its been a LONG time since i have been on here! recently i am just getting back into programming and i am creating a program that will open up a log file and read some data from it and store it in hashes. anyways, my question is, how do i open up a file in perl to read from it? I think its a simple question, but unfortunetly i havent found a simple answer. if someone can point me to a tutorial or something of the sort, or better yet, explain it, that would be much appriciated. In the meantime, i will continue searching on google and other places for the answer. I am sure i will have more questions so stay alert! Thanks in advance...
Support your right to arm bears.

^^This was the first video game which i played on an old win3.1 box
-
June 23rd, 2005, 08:31 PM
#2
http://search.cpan.org/dist/perl/pod/perl.pod
open (HANDLE, filename)
open (IN, "/path/to/foo");
At this point its just another file handle so you would input like with STDIN <>, so:
while ( $_ = <IN> )
{
blah;
}
close(IN);
There is only one constant, one universal, it is the only real truth: causality. Action. Reaction. Cause and effect...There is no escape from it, we are forever slaves to it. Our only hope, our only peace is to understand it, to understand the 'why'. 'Why' is what separates us from them, you from me. 'Why' is the only real social power, without it you are powerless.
(Merovingian - Matrix Reloaded)
-
June 23rd, 2005, 08:39 PM
#3
perfect thanks i wish they just wrote that in the books...
Support your right to arm bears.

^^This was the first video game which i played on an old win3.1 box
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|