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. 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. Thanks -----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