Just another Perl shrine | |
PerlMonks |
Re: How to use this subroutineby wjw (Priest) |
on Oct 16, 2017 at 15:55 UTC ( [id://1201462]=note: print w/replies, xml ) | Need Help?? |
I modified your script just a bit to show you what I believe it is supposed to do. If you are just trying to get this done, what is below should work for you. I name the sequence files in the script instead of using ARGV, and otherwise just made changes to make it work. It is still not pretty, but it will run as re-written. I would suggest you look into the perlref tutorial to see why things did not work in the codes as you posted it. If you are really interested in why the code did not work for you as hoped, note each change made, then take both your original code and the little hack below and run them with perl -d. If the Perl debugger is too much for you (it should not be, it is pretty simple) Put print statements in various places that are useful to you so you can track what is happening in that subroutine. Better yet, do both.
The bottom line is that the code you posted was not handing in what you thought it was to the pretty_print() sub. $colno wants the number of columns to print on a given line... Do take the time to learn about the Perl debugger, always 'use strict' and 'use warnings', and use this site and perldoc perltut to help you along. Hope that gets you started... ...the majority is always wrong, and always the last to know about it... A solution is nothing more than a clearly stated problem...
In Section
Seekers of Perl Wisdom
|
|