Click to See Complete Forum and Search --> : Include in Perl???


rugrat15834
06-20-2006, 07:44 PM
HI, I am curious as to whether or not there is some kind of function or way to "include" other docs in another one-like the way php uses include. Thanx, Dave :)

robertketter
06-21-2006, 09:26 PM
Dave,

The answer is simply Yes. Perl does have an include. If you need more information about include re-post and someone much smarter then me will tell you all about it and how to use it.

Robert Ketter

JulianJ
06-22-2006, 10:18 PM
Check out require, like so:

require "somemodule.pl";

Julian

rugrat15834
06-23-2006, 10:11 PM
Thanx-that's a start-I'll get on by checking out the perl cookbook. Fear not though-I'm not the one smarter than you. If I can collect enough info on the subject I'll repost with it. Thanx again, Dave

CyCo
06-24-2006, 12:28 PM
You can use do (http://perldoc.perl.org/functions/do.html), use (http://perldoc.perl.org/functions/use.html), eval (http://perldoc.perl.org/functions/eval.html) or require (http://perldoc.perl.org/functions/require.html) to include from external files, although each has a different method of execution.

rugrat15834
07-01-2006, 08:01 PM
Me again, as usual, I have once again decided to take the easy way out. In every case in which I needed something like this it has always been in such a situation where I could just use a sub-routine, that is, if, say for example I needed a table cell to appear at the left side of the page I could just create a sub file and call it accordingly. A nice thing about doing it this way is that one can make the sub to match the situation simply by calling the sub through an if statement, i.e.
if($current_subject eq "fishing"){
& fishing; }
elsif($current_subject eq "hunting"){
& hunting; }
I realize this description is pretty vague but the point is you could tailor just about any situation to jump right into the proper subject on the fly. I can give a better description if this don't make sense. I would really like to thank everyone here for all the help. If it weren't for forums like this I would have drowned a long time ago.->Dave