I have data file which has 6 column, I am trying to take the first value(-16.2577) of 6th column and substract it to the rest of the values of 6th column.
I split the file on space and stored in an array but the problem is I am not able to pick the first value and substract it in while loop.
DATA FILE:
-16.2262 -6.01803 -25.5829 -19.4488 -14.0128 -16.2577
-18.6505 -23.0397 -26.0685 -24.5328 -21.9307 -22.8444
-30.1621 -22.6838 -17.0961 -17.0979 -16.7653 -20.761
-21.5754 -21.2215 -13.6387 -12.3095 -17.8838 -17.3258
-21.7664 -25.4331 -22.6777 -23.1687 -24.755 -23.5602
-16.739 -13.0645 -28.5916 -19.7581 -24.1668 -20.464
-15.3542 -21.8463 -24.1616 -33.7034 -22.4266 -23.4984
-17.021 -22.1811 -23.1971 -11.4303 -29.3547 -20.6368
-25.7525 -15.5314 -20.4551 -19.9354 -26.7343 -21.6817
-12.4969 -9.64406 -23.1891 -18.2173 -18.8544 -16.4804
-22.9877 -26.167 -25.5358 -10.8135 -19.1759 -20.936
-17.3839 -14.6625 -12.1523 -16.8928 -28.1319 -17.8447
-14.5102 -15.1774 -21.9974 -24.3167 -27.1646 -20.6333
-12.6622 -17.8959 -17.2385 -17.1209 -18.1484 -16.6132
-23.6795 -23.24 -24.8987 -13.5031 -27.6614 -22.5965
-19.0322 -14.2305 -26.3313 -19.6006 -28.2886 -21.4966
-20.5431 -7.20871 -21.5272 -14.0325 -24.7013 -17.6026
-20.7694 -13.2671 -29.6587 -16.5918 -19.0846 -19.8743
-12.4844 -10.0744 -23.2201 -21.8157 -21.002 -17.7193
-20.9622 -15.8527 -22.7274 -28.2274 -28.6891 -23.2918
-24.8432 -11.8968 -24.58 -18.6088 -22.4424 -20.4742
Expand|Select|Wrap|Line Numbers
- #!/usr/bin/perl
- use strict;
- use warnings;
- open(A,"rot_1.dat");
- while (<A>)
- {
- my @temp = split(/\s+/,$_);
- my $a = $temp[5];
- $a = $a - (-16.277);
- print "$a\n";
- }
Thanks
Kumarboston