File reading in Perl

i_guhathakurta wrote on Thu Mar 27 20:20:22 CET 2008:
I am trying to read in a file in my Perl code. This is my code:
#!/usr/bin/perl -w

use strict;

my $total = 0;
my $count = 0;
while (my $line = <>) {
	$total += $line;

print "Average = ", $total/$count,"\n";

The file I want to read in is numbers.txt. On the cmd prompt I would just
perl numbers.txt

How do I do this in Eclipse? I am at my wits end!!!
jploski wrote on Thu Mar 27 20:30:05 CET 2008:
You didn't read the User Guide nor did you find the Arguments tab for the
launch configuration in the Run... dialog, did you?
i_guhathakurta wrote on Thu Mar 27 20:58:27 CET 2008:
I did try the Arguments tab but it still didn't accept the file. What am
I doing wrong?
Do you know how to do it?
jploski wrote on Thu Mar 27 21:12:07 CET 2008:
It works perfectly for me in EPIC 0.6.22. What do you mean precisely by
"didn't accept the file"?
i_guhathakurta wrote on Thu Mar 27 21:17:05 CET 2008:
Got it!!! I don't know why it wasn't working, now it is. Took me the best
part of the whole day to get it to work. I need to try it with some other
files etc. Thanks for the tip. By the way, user guide is hopeless!!
jploski wrote on Thu Mar 27 21:28:14 CET 2008:
Thanks for the encouraging words about the user guide. The feature you were
looking for is described on page 25.
bearslumber wrote on Wed Jul  9 14:37:57 MEST 2008:
I beg to differ. 

I think the user guide is pretty good.

Perhaps igstyer could be more specific in his criticism; i.e. constructive

In that way he/she can enable Jan to focus on improving particular aspects
of the user guide.

Jan Polski has taken the effort to carry out all this work and for that
we must all be appreciative. 

I am very appreciative for sure as I have experience in the amount of work
all this development entails. After all we are not paying him/her to do
the job. He/she is helping us with the good will that comes with the community.

I take this opportunity to thank Jan Ploski very much for all his/her efforts.

I apologise for not being aware of your gender.



Note: The above is an archived snapshot of a forum thread. Use the original thread at to post comments.