Jul 14, 2013, 8:05 AM
That's quite funny, FishMonger.
Re: [FishMonger] perl script to gather dbtable size and memory
When I first saw Jeffersno1's original post, I thought that I was going to suggest a solution based on the split function. Then, seeing the two solutions proposed by Bill and you, I decided that there was no point suggesting a third solution.
With Jeffersno1's new post stating that there can be multiple spaces, I looked at the Text::CSV documentation and found it difficult to figure out what this module would do with such input or if it was even possible to change some configuration items to have it do the expected processing. It is also not practical to preprocess the lines to remove the extra spaces (or we would need to preprocess the whole file). So I tought: OK, I'll try to give a a solution modifying Bill's proposal and wait to see if FishMonger has an idea with the CSV module.
Just one small comment on your code: I think it would be slightly simpler (and possibly slightly faster if the file is large) to do the tr/// before the split:
$row =~ tr/"//d ;
my @row = split /\s+/, $row;
(This post was edited by Laurent_R on Jul 14, 2013, 8:06 AM)