http://www.perlmonks.org?node_id=1161700

BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:

Update!

Before I posted, I tried a bunch of things and ran it at least a dozen times getting the exact same failure. I the cut the script of the top of the data, renamed the file .dat and stuck the script into a new file of the old name. I changed <DATA> to <> and supplied the data file on the command line and it worked first time.

I've just recreated the all in one script; and now it runs perfectly. I have no explanation for the error or the cure; but I suspect 1nickt called it.

Thanks for your help guys.


I'm getting this error when I try to run the following code:

C:\Motor>parseAns.pl The process cannot access the file because it is being used by another + process.

Another process is accessing the DATA pseudo-handle?

The data is large 2.4 million, but I'm sure I've processed much larger datasets from <DATA> before; and I've commented out the storing of the data to the array, so it isn't running out of memory. Cluebats anyone?

#! perl -slw use strict; my @data; my $i = 0; #$data[ $i++ ] = [ split ' ' ] ++$i while <DATA>; print $i; __DATA__ -69.282032302755084 40.000000000000014 0 -1 -69.123493781255831 39.908467741935496 -1.4443382565142906e-006 -1 -68.748013135538145 40.911009397420145 0 -1 -68.964955259756593 39.816935483870985 -2.990721348858345e-006 -1 -68.370049396495517 40.298149116372635 -6.3944096502804299e-006 -1 -68.202015544462682 41.814890597403163 0 -1 ... 2.4 million lines omitted.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.