"Jair V. B. Junior" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all, here comes a little confusing question :-)
>
> a.pl:
> #!/usr/bin/perl

use warnings;  #this will help show you where you went wrong

> require 'b.def';

The code in b.def is executed right now, before anything else in a.pl is
executed

> $test = 'World!';

*now* you're defining the variable $test.

> print $abacus;
>
> b.def:
> $abacus = "Hello $test";

At the point in which this file is require'd, no such variable $test
exists.  $test is therefore undefined (which is treated as an empty
string in string context).  So this line is equivalent to:
$abacus = 'Hello ' . '';

> When I run it:
> $ perl a.pl
> Hello
>
> Why is this going wrong?

Hope this helps,
Paul Lalli


-- 
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