By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,903 Members | 1,677 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,903 IT Pros & Developers. It's quick & easy.

reading .txt file in array format

P: 2
how to store data of .txt file into array. means one line it treats as a one element of array. next line is next elment and so on..
Nov 29 '07 #1
Share this Question
Share on Google+
3 Replies


numberwhun
Expert Mod 2.5K+
P: 3,503
how to store data of .txt file into array. means one line it treats as a one element of array. next line is next elment and so on..
This is a pretty basic question and I think you need to go and read something like Beginning Perl.

I am not saying that we are above these questions, because we are not, but you learn by reading and doing and that is something that is pretty easy.

Regards,

Jeff
Nov 29 '07 #2

KevinADC
Expert 2.5K+
P: 4,059
I agree with Jeff, read the link he posted. Next time pleasae show some effort to solve your questions:

Expand|Select|Wrap|Line Numbers
  1. open (FH, 'filename') or die "$!";
  2. my @array = <FH>;
  3. close FH;
  4. print "$_" for @array;
Nov 29 '07 #3

numberwhun
Expert Mod 2.5K+
P: 3,503
I agree with Jeff, read the link he posted. Next time pleasae show some effort to solve your questions:

Expand|Select|Wrap|Line Numbers
  1. open (FH, 'filename') or die "$!";
  2. my @array = <FH>;
  3. close FH;
  4. print "$_" for @array;
Same user, two different questions, same link to the same book given. Gotta love it.
Nov 29 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.