Hi all, I'm still having a problem with my output, if you can help? My current program is collecting numbers and doing a calculation which is all fine. However, I have a problem with the spacing in the output file.I'm only dealing with the "NEWFILE" output here in my program. My current output looks like this:
This is fine but the problem is the spacing between the entries. I currently have 2 spaces between each entry eg 2(E)( 24.87)Q and
3(E)( 46.58)T. However, because I have 1 digit before the, eg (E), 2 digits and 3 digits the spacing gets mixed up. I need an output format with the same distance between the start of one entry and the start of another. Eg like :1(E)( 95.58)A 2(E)( 24.87)Q if there is one digit before the(E), 10(E)( 23.33)L 11(E)(0.00)I if there are 2 digits before the (E) and like 165(E)( 6.04)I166(E)( 15.29)G if there are 3 digits before the (E).
I think its just a matter of changing the "printf NEWFILE "$residual($A)(%6.2f)$AA ", $calcval;" line...I hope you can help!
Thanks
program:
#!/usr/bin/perl
use strict;
my %vals = (A => 113,
V => 160,
L => 180,
I => 182,
P => 143,
W => 259,
F => 218,
M => 204,
G => 85,
S => 122,
T => 146,
Y => 229,
C => 140,
N => 158,
Q => 189,
K => 211,
R => 241,
H => 194,
D => 151,
E => 183,
X => "N");
my $offset = 0;
my $linecnt = 1;
my @ResVals = ();
my @AAVals = ();
open(INFILE, "/home/paul/tester3") or die "cannot open input file $!";
open(OUTFILE, '>b') or die "cannot open output file $!";
open(NEWFILE,'>a') or die "cannot open output file $!";
while (my $line = <INFILE>) {
next if ($line =~ /HYDROGEN/);
1(E)( 95.58)A 2(E)( 24.87)Q if there is one digit before the(E),
10(E)( 23.33)L 11(E)(0.00)I if there are 2 digits before the (E) and like
165(E)( 6.04)166(E)( 15.29)G if there are 3 digits before the (E).
0
paulieomearaAuthor Commented:
apologies ....for the third: 165(E)( 6.04)I166(E)( 15.29)G if there are 3 digits before the (E).
0
paulieomearaAuthor Commented:
This is ridiculous I know....but what I need is always 4 spaces altogether between the last letter entry in the example and the start of the open bracket like this for example:
1(E)( 95.58)A 2(E)( 24.87)Q 10(E)( 23.33)L 11(E)(0.00)I 165(E)( 6.04)F 166(E)( 15.29)G165 (E)( 6.04)
0
Be seen. Boost your questionâ€™s priority for more expert views and faster solutions
An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.
One of a set of tools we're offering as a way of saying thank you for being a part of the community.
1(E)( 95.58)A 2(E)( 24.87)Q if there is one digit before the(E),
10(E)( 23.33)L 11(E)(0.00)I if there are 2 digits before the (E) and like
165(E)( 6.04)166(E)( 15.29)G if there are 3 digits before the (E).