Mega Code Archive

 
Categories / Perl / Language Basics
 

Block main

#!/usr/bin/perl use strict; use warnings; my $global_variable = "All the World can see Me"; use constant MY_GLOBAL_CONSTANT => "Global Constant"; MAIN: {     my $main_variable = "Not visible outside main block";     print_variables ($main_variable); } sub print_variables {     print $global_variable, "\n", MY_GLOBAL_CONSTANT, "\n";     print $_[0], "\n"; # passed from main block, ok now }