Are there general guidelines for including code in a research paper? I'm a beginning researcher trying to write a research paper , so please bear with some of the really basic questions I might have. I've already looked around for some help online, but the websites I found were vague.

My program is written in perl. Should I include my code in the paper? If so, is there a maximum number of lines? Will people expect me to include all of it in the paper (either in the appendix or in the body) or can I just write out in text the general idea of what it does?
In general, I would never include code in the "main" paper outside of computer science or applied mathematics. There are very few cases where listing code explicitly would actually improve the quality and readability of the paper. If it is necessary to include the code, I would do so as part of the "Supporting Information" which many journals allow you to include alongside the main publication. I would then describe the features of the code as words in the main text.

Even in CS and math papers, I would still only put pseudocode in the main article, and would save any listings of actual code for the Supporting Information.