in reply to Re: Re: Daft text adventure project
in thread Daft text adventure project

1. How to store routines in separate files:
#file use strict; sub xxx1 ($\%\@@) # define xxx1 with prototype { blah blah; return ...; } # end sub xxx1 use Exporter(); @ISA=qw(Exporter); @EXPORT = qw(xxx1); # exports name xxx1
Now, in your program file, you may call subroutine defined in above:
use strict; use shared1; # 'include' shared code ... # call sub defined in my $result = xxx1($arg1, %arg2, @arg3, $optarg1, $optarg2); ...
2. In project this huge, I advise to use not only 'use strict' everywhere, you may want to learn how to do 'prototypes' as well. It will help you to detect (some) errors when wrong numbers or types of parameters are passed to subroutine. While on that, you can also learn to pass hashes as references. Good luck on your long jourmey! PMAS