1) I wrote a few functions to give me the LaTex formatted string for the prime factorization of a number. I based it on an example I found via google. It works great, but I will have several other problems that will need to use it, so I wanted to put the functions in a separate .pl file and include it. I tried this, by putting a my_utils.pl file in the same folder as my problem set, and then copied pasted the code into that file. I then added my_utils.pl to the LoadMacros() call in the actual problem's .pl file. Suddenly the function fails. I am new to Pearl so assuming I just did it wrong. Can somebody give me an example of how to do this?
2) I am finding myself making a lot of variables just so I can display them in the solution. Here's a silly example:
$num = 24;
$num2 = 36;
$lcd = lcd($num, $num2);
$lcdPretty = prettyFactor($lcd); # this is the function that returns prime factored version of an integer.
...
# SOLUTION
The prime factorization of the [`` \begin{aligned}
= {[$lcd]} \end{aligned} ``] is [`` \begin{aligned}
= {[$lcdPretty]} \end{aligned} ``]
...
Is there a way I can avoid making a second variable just to display it, and instead simply display the result of a function call?
something like this:
The prime factorization of the [`` \begin{aligned}
= {[$lcd]} \end{aligned} ``] is [`` \begin{aligned}
= {prettyFactor($lcdPretty)} \end{aligned} ``]
Thanks for any guidance you can provide!
Paul