[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-AnyPerl] This Seemed So Simple...



Hi, Richard

When you "do" or "require", think of this as straightforward inclusion.

For example, let's assemble script "pfile.plx" as

	#!perl -w

	require "pfile1.pl";
	require "pfile2.pl";

where "pfile1.pl" contains the line

	$var1 = 3.13;

and "pfile2.pl" contains the line

	print "VAR = $var1\n";

Running this the output is

	VAR = 3.13

So you see that essentially "do" and "require" are #include mechanisms. I
can chop any script up into N pieces, call them "piece1.pl" through
"pieceN.pl", and assemble them in one master script which has N requires.
This assumes that no package statements are used, of course.

The above example clearly demonstrates that since you are presumably NOT
using package statements, that the potential for one "require"'d script to
affect is significant.

Finally, the files are treated just as chunks of code. There is no reason
why the contained code has to execute to completion.

What you're really looking for is

	perl script1.pl
	perl script2.pl
	perl script3.pl

and Christian gave you one solution. What you actually did was

	perl "script1.pl" + "script2.pl" + "script3.pl"

where the '+' means concatenate.

Arved



==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org