Hi, I have following code which works ok. It does following:
1. reads data from a input file 2. puts the data into seperate variables in a array 3. reads from this array and prints out to another file It works except that it prints the same record 4 times. I can see I have missed some thing in my array definition as their are 4 elements in array, it is printing 4 times each element and then moving to next element till it reaches eof(). while (<input>) #reading a line from file # Read the line into a set of variables ($1,$2,$3,$4)=split(/,/,$_); .... .... # Buid an array with these varaibles my @array = ([$1, $2, $3, $4]); foreach my $r(@array) { foreach (@$r){ ... print <out> "$1\n"; print <out> "$2\n"; print <out> "$3\n"; print <out> "$4\n"; print <out> "\n"; The out put is coming like this: yellow blue orange red yellow blue orange red yellow blue orange red yellow blue orange red black white red pink black white red pink black white red pink black white red pink Clearly it should just print one time and go to the next record.... Please suggest. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/