At the mom this code works prefectly fine but i am having problems changing it so that it only affects the first line of values and not all.
while (<FILE1>) {
($hash, $input, $for, $aa) = split( /\s+/, $_) if /^\# \input\b.*/;
if ($aa =~ /LEU\b/)
{s/ (.*)/$z3leu $z2leu $z1leu $1/}
print;
}
FILE:
# INPUT FOR LEU
0.897 0.254 - so make s//g before these values
0.121 0.254
ETC
Thanks,
Just an idea but why not treat the file as an array with each line as an element in the array. You can do all of the other stuff spliting lines into variables just as easily on your array elements as you currently are.
The Tie::File module makes a file into an array of lines. Then you can reference $array[0] and run it through your regex.
Google "treating file as an array" for more info.
I hope that this helps
Best wishes
Sid