Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
Last number in the array --- access problem --Newbie question
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Go Perl, post: 4741012"] Here is the complete problem: I have two files MAER_FILE and EVAL_FILE MAER_FILE contains ITR Max_error Avg_error Min_error 1 0.849197022974602 0.845806355744732 0.843444019245762 2 0.844939386865682 0.841991065818245 0.837942476416068 3 0.844144961481595 0.841099932356234 0.836919185707587 4 0.844144961481595 0.841099932356234 0.836919185707587 5 0.840596405164578 0.838883453436171 0.836919185707587 6 0.839512137681004 0.838072896555497 0.836534486876684 I have to get the last number of the 4th column which is 0.836534486876684 and so i use the following code. #------ open (MAER_FILE, "MAER_output.txt"); while (<MAER_FILE>) { chomp; my @maer_array = split(/\t/); print "$maer_array[-1]\n"; } #------ But this gives me the output as the entire 4th column instead of just the last number. once i get the last number which is 0.836534486876684 i have to search for this number in EVAL_FILE which looks like ITR CHR SUM Error Error(%) 0 1 46.7058362636031 0.849197022974602 84.9197022974602 0 2 47.0231420611022 0.854966219292767 85.4966219292767 0 3 46.4794258296669 0.845080469630308 84.5080469630308 0 4 46.6549049902152 0.848270999822095 84.8270999822095 0 5 46.8269040494763 0.851398255445024 85.1398255445024 0 6 46.9823066656241 0.854223757556801 85.4223757556801 0 7 46.3894210585169 0.843444019245762 84.3444019245762 0 8 46.4279728814877 0.844144961481595 84.4144961481595 0 9 46.4266047910362 0.844120087109749 84.4120087109749 The last number in the previous line must match with one of the number in the 4 th column of the above file and i should be able to extract the entire line. I am not able to store these columns into arrays..either i don't know perl or arrays. Please help me solve this problem efficiently. Thanks in advance, GP [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
Last number in the array --- access problem --Newbie question
Top