Check for decimal point and add it at the end if its not there using awk/perl

I have test.dat file with values given below:

20150202,abc,,,,3625.300000,,,,,-5,,,,,,,,,,,,,,,,,,,,,,
20150202,def,,,,32.585,,,,,0,,,,,,,,,,,,,,,,,,,,,,
20150202,xyz,,,,12,,,,,0.004167,,,,,,,,,,,,,,,,,,,,,,

My expected output is shown below:

20150202,abc,,,,3625.300000,,,,,-5.,,,,,,,,,,,,,,,,,,,,,,
                                  ^. added here
20150202,def,,,,32.585,,,,,0.,,,,,,,,,,,,,,,,,,,,,,
                            ^. added here
20150202,xyz,,,,12.,,,,,0.004167,,,,,,,,,,,,,,,,,,,,,,
                  ^. added here

So if column 6 and 11 doesn't have decimal point in it, then we should add '.' at the end of the file.

I have tried below code but it's throwing error message during split

#!/usr/bin/perl
use strict;
use warnings;
my $filename = 'test.dat';
open my $fh, $filename or die "Could not open file '$filename': $!";
my @cols_to_change = qw ( 5 10 );
while (my $val = <$fh>) {
   my @row = split (/,/);
   foreach my $col ( @cols_to_change ) {
      unless ( $row[$col] =~ m/\./ ) { $row[$col] .= '.' }
   }
   print join ( ',', @row );
}

Error message is given below:

Use of uninitialized value in split at test.pl line 11, <$fh> line 1.
Use of uninitialized value in pattern match (m//) at test.pl line 13, <$fh> line 1.
Use of uninitialized value in pattern match (m//) at test.pl line 13, <$fh> line 1.
Use of uninitialized value in join or string at test.pl line 15, <$fh> line 1.
Use of uninitialized value in join or string at test.pl line 15, <$fh> line 1.
Use of uninitialized value in join or string at test.pl line 15, <$fh> line 1.
Use of uninitialized value in join or string at test.pl line 15, <$fh> line 1.
Use of uninitialized value in join or string at test.pl line 15, <$fh> line 1.
Use of uninitialized value in join or string at test.pl line 15, <$fh> line 1.
Use of uninitialized value in join or string at test.pl line 15, <$fh> line 1.
Use of uninitialized value in join or string at test.pl line 15, <$fh> line 1.
Use of uninitialized value in join or string at test.pl line 15, <$fh> line 1.

Could you please analyze the issue and provide solution asap? I am happy if this could be done using awk but I am NOT allowed to use any additional perl modules in my environment E.g: Text::CSV.

Regards,
Vino.

Sounds like homework, is it?
If so, please see the reagarding subforum after reading ist sticky.

Thank you