Include a file: Difference between revisions
Content added Content deleted
Line 237: | Line 237: | ||
=={{header|Perl}}== |
=={{header|Perl}}== |
||
Presumably this task is not about loading libraries or running programs in other languages. For loading another perl program inside perl, use |
|||
Here we include the file include.pl into our main program: |
|||
<lang Perl>do "filename";</lang> |
|||
main.perl: |
|||
<lang perl>#!/usr/bin/perl |
|||
do "include.pl"; # Utilize source from another file |
|||
sayhello();</lang> |
|||
include.pl: |
|||
<lang perl>sub sayhello { |
|||
print "Hello World!"; |
|||
}</lang> |
|||
From documentation:<pre> |
From documentation:<pre> |