1. I missed the significance of the $fac value. my bad!
  2. You told us you "start with" the $fac values. Now you show that's not the case. Your bad!
  3. Since you are calculating that, you have all the data points needed to solve your alignment problem.
  4. chop does NOT do what you appear to think it does. See the docs for chop and chomp, the latter of which more reliably removes a trailing newline (as opposed to discards the final entity on a line).
  5. The regex matches in your initial test, above, if ($_ =~/(.*)/) {...}? matches anything or nothing (ie, is useless or 'ALWAYS true-for-any-non-blank-line'): the dot means any character (alpha, digit, punct, or whitespace (except \n and the * quantifier means "none" or "any-quant-more-than-none" (see perlre).
  6. Var names such as $f, $s may be 'meaningful' to you, today... but they're apt to give grief, agitta and annoyance to some future you - or to the homicidal maniac who knows where you live and who may have to take over maintenance someday. Name vars with names or obvious and unambiguous abbreviations. They'll save you g,a and a.

So, bottom line, I'm not giving you the code to solve your alignment problem; you'll learn more by solving that yourself, with the info you now have in hand, than by getting an algorithm spelled out or by copying code. But before you tackle that one, read the cited regex doc, and probably the tuts here. (Yes, they're directly relevant to one approach.)


In reply to Re^3: Info based on total changes by ww
in thread Info based on total changes by pqocpiha

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.