push(@factored_rows,%coefficient_array);
should be
push(@factored_rows, \%coefficient_array);
otherwise a hash gets flattened in a list of keys and values. Without '\' it's as if you wrote if like that:
push(@factored_rows, 'hash_key1', $value1, 'hash_key2', $value2);

(hash is not an array, btw, they are totally different things)

Also, your program is hard to read. Some advice:
@factored_eqns = &factorize(\@eqn_set,\@variables);
'&' in factorize is completely unnecessary.
my @factored_eqns; ... @factored_eqns = factorize(\@eqn_set,\@variables);
Don't declare a bunch of variables all at the top of the program/sub. They're not much better then global variables when used that way (and it's very write-only). Perl is not C89. Instead of:
my @factored_eqns; ... @factored_eqns = factorize(\@eqn_set,\@variables); ... my $term; ... foreach $term(@{$equation}) { ...
do
my @factored_eqns = factorize(\@eqn_set,\@variables); ... foreach my $term (@{ $equation }) { ...
Indent your code properly. Rather then
foreach $equation (@this_eqn_set){ #then for each variable in the eqution foreach $variable (@this_variable_set){ ...
Write it like so:
for my $equation (@this_eqn_set) { for my $variable (@this_variable_set) { ...
(for and foreach are the same thing)

Uncomment strict. And add use warnings;


In reply to Re: Help !!! Symbolic Math Factroize Subroutine is clobbering my hash by Anonymous Monk
in thread Help !!! Symbolic Math Factroize Subroutine is clobbering my hash by ipreferperl

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.