HI All, I have the following data in a csv file:
DeviceID,FreeSpace,Size C:,95342874624,476216029184 E:,2119757824,2133852160 G:,3295703040,21425549312
I use the following code to load the txt file into an array.
open(my $fh, '<', $file) or die "Could not open '$file' $!\n"; while (my $line = <$fh>) { chomp $line; my ($drive, $sizegb, $freegb) = split (/,/,$line); print qq($sizegb); $sizegb /= 1024; print qq($sizegb); }
When I run the script:
The first print of size gb output: 9 5 3 4 2 8 7 4 6 2 4
The second print output: 0
I am not sure where i am going wrong with the spaces in the number of output 1 which I assume is why the division is not working. When i try to do an index for space i get -1 as the result.
Please assist.
Regards
Vishaal
In reply to Arrays and division not working... by Vishza
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |