On Jun 28, 2004, at 11:15 AM, Naser Ali wrote:
Below is the actual code. This is just the preliminary code to test the
logic, it is not final yet, therefore, I am not using "Warnings", "Strict"
or for that matter anything else.
It's easy to make excuses, harder to do the right thing. Help us help you. I've seen enough of your posts, these lessons should be learned by now. You START with warnings and strict, when they can help you most.
I bet you would be getting warnings right now, if only you would turn them on. Then, if you followed them, you might just solve your own problem.
Also I am slurrping the whole file, and I know I do not have to, but alternate ways, I ll decide later.
Why? Why code it twice? Two different techniques. Just use the right one, and stop hindering your own growth as a programmer.
----------------------------------------------------------------------- --
open(TFILE, "file.txt");
... or die "..."; # MUST test success
@first=<TFILE>;
Not needed, and you know it.
close (TFILE);
for ($i=0; $i <= $#first; $i++) {
In Perl, we write that:
for my $i (0..$#first) {
Of course, you aren't even using indexes, so better is:
foreach (@first) {
$Avg=$first[$i];
Why?
chomp($Avg); ($label,$TD,$YT,$M,$L,$Y,$W)= split (/\s+/,$Avg);
... split ' ', $Avg;
If it's not working, $Avg doesn't contain what you think it does. Add a print statement before to prove it.
print "$label,$TD,$YT,$M,$L,$Y,$W\n"; }
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>