> > Thanks Charles, > > Now your polite comments on using warnings make me think and as well as > guilty. Also emphasizes on going an extra mile at times helps save time. > Point well taken, > > But on the other hand there are people on the list like "Mr. James Edward > Gray II" has some ego problems. No body asked you to answer my question.
Careful James has answered a lot of questions and done a very good job of it, and these postings are archived. if > you really think beginners like me, for whom this list was created in the > first place, are not worthy of your expertise and knowledge, then please by > all means spare us from your wisdom and as well as criticism. You must bare > mind that different people think differntly and will have different approach > which must not be mistaken by polity and lazyness without knowing for sure. > > With all due respect, if you can't, then do not help. The world will survive > without your help. > He did help, and his position was supported by similar statements from another poster. You yourself also stated you didn't want to waste other poster's time, but not turning on strict/warnings is a direct contradiction of that. He also mentioned that you had been around a while and should no better, I can't attest one way or another, so many names are just fly bys, but you should take that as a complement and a hint... I will admit this is a beginners list, but if you thought James' comments were harsh you need to grow a much, much tougher skin before venturing out on to the rest of the internet. Good thing Randal wasn't around ;-).... http://danconia.org > > -----Original Message----- > From: Charles K. Clarkson [mailto:[EMAIL PROTECTED] > Sent: Monday, June 28, 2004 12:39 PM > To: 'Naser Ali'; [EMAIL PROTECTED] > Subject: RE: string seperated by multiple spaces > > > From: Naser Ali <mailto:[EMAIL PROTECTED]> 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. > > Use strict and warnings from the very beginning. Don't > wait while you're testing. I use them always. Even for the > itty bitty scripts. > > > : Also I am slurrping the whole file, and I know I do not have > : to, but alternate ways, I ll decide later. > > There's nothing wrong with pulling in the whole file > at once if you are certain the file size will remain > small. > > > : open(TFILE, "file.txt"); > : @first=<TFILE>; > : close (TFILE); > : > : > : for ($i=0; $i <= $#first; $i++) { > : > : $Avg=$first[$i]; > : chomp($Avg); > : ($label,$TD,$YT,$M,$L,$Y,$W)= split (/\s+/,$Avg); > : print "$label,$TD,$YT,$M,$L,$Y,$W\n"; > : } > > That works fine. Perhaps file.txt is not opening or contains something > you don't expect. Try this: > > > use strict; > use warnings; > > > my $file = 'file.txt'; > open FH, $file or die "Cannot open $file: $!"; > my @averages = <FH>; > close FH; > > foreach my $average ( @averages ) { > > chomp $average; > > my @fields = split ' ', $average; > > print " Bad line --> $average " unless @fields == 7; > > print join( ', ', @fields ), "\n"; > } > > __END__ > > > HTH, > > Charles K. Clarkson > -- > Mobile Homes Specialist > 254 968-8328 > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>