|
|
| Perl-Sensitive Sunglasses | |
| PerlMonks |
reading a text file and accepting inputby doozy (Initiate) |
| on Apr 27, 2012 at 22:28 UTC ( #967730=perlquestion: print w/ replies, xml ) | Need Help?? |
|
doozy has asked for the
wisdom of the Perl Monks concerning the following question:
I have a code that determines the distance between some points and lists the distances in a matrix like so,
Right now I type the points manually, but I want the code to read the text file itself so I don't type 900+ values manually. Here is the format of the text file (file.txt):
X and Y is extra information, not important for calculating distance. And here's the code I have (Thank you to user NetWallah for help with this):
I added the "A=>" part because I wanted the matrix to show that parameter when it listed distance, but I have been unable to work that in properly. This is the distance equation I am using:
I would appreciate any advice on how to get the code to 1) read the values so I don't have to type them manually, and 2) print the matrix like so:
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||