in reply to How can i "include" an executable section of code

Yes, Perl doesn't have include. It doesn't have a preprocessor like C does either.

However, it does have use, require, do, and eval.


Dave

Replies are listed 'Best First'.
Re: Re: How can i "include" an executable section of code
by DrHyde (Prior) on Jan 13, 2004 at 11:03 UTC
    Of course, you can use the C pre-processor if that floats your boat. It's probably not the right solution though :-)
Re: Re: How can i "include" an executable section of code
by mildewhall (Initiate) on Jan 14, 2004 at 11:28 UTC
    As a followup, having tested the "do" option, I found that using "require" was altogether the best option, especially in terms of memory usage on large files.
    $client = $Options{'c'}; # # call in the relevant client code # require "$client.segment"; #
    and the $client.segment file contains
    sub DoClient { # client 'A' my $EURO = 1.35; if ( m/(\S+),(\S+),(\S+),(\S+),(\S+),(\S+)/o ) { @fields = split(/,/); ...... } }1;