develooper Front page | perl.perl6.compiler | Postings from April 2012

[perl #112632] our variables or subroutines cannot be called from outside scope

Thread Previous
From:
Philippe de Rochambeau
Date:
April 28, 2012 01:29
Subject:
[perl #112632] our variables or subroutines cannot be called from outside scope
Message ID:
rt-3.6.HEAD-4610-1335534964-297.112632-82-0@perl.org
# New Ticket Created by  Philippe de Rochambeau 
# Please include the string:  [perl #112632]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=112632 >



Perl6 version: 2012.04.1

{
	our $truc = 'machin';
	our sub eat() {
		say "om nom nom";
	}
}
say $truc;
eat(); 

[This code comes from the Perl6 Tutorial]


Result:

===SORRY!===
Variable $truc is not declared



If you remove say $truc, you will get the following error message:

Undefined routine '&eat' called (line 15)






Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About