[EMAIL PROTECTED] wrote:

>
> Here's what it prints:  My name is $name.
>
> Here's the testmessage.txt file:  My name is $name.

Hi Stuart,

I think that there is a conceptual problem here.  This really isn't the
appropriate way to get modular code into a program.  Programming would be a
dangerous business indeed if our programs automatically interpolated variable
names encountered in text data.

The techncal concerns are relatively minor compared to the conceptual
problems.  I would recommend against pursuing this path of inquiry, because
the mixing of data and program code is inherently a seed of error and system
instability.  It also can be an easy route for subverting system security.
Data and program structures should not be mixed without compelling reason, and
a high-end understanding of the potential consequences.  New students of
programming should avoid it entirely, IMHO.

Can you think of a real-world situation where you would want to put program
code in a data file?  If you want modular functionality, Perl does have some
very approachable protocols for creating packages of such functionality,
including the option of creating instantiable objects to reflect real-world
concepts.  For this, you might want to start with:

perldoc perlmod
perldoc perlobj
but first, for necessary background, read
perldoc perlref
or at least
perldoc perlreftut

Use the language features designed for linking functions, though.  Hand-hcking
mixed code and data will only get you in trouble.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to