Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Daft text adventure project - from pmas

by pmas (Hermit)
on May 29, 2001 at 23:25 UTC ( #84048=note: print w/replies, xml ) Need Help??

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

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://84048]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2023-01-29 08:33 GMT
Find Nodes?
    Voting Booth?

    No recent polls found