Perl , Perl, Perl :: ', , (, ). :
use strict;
use warnings;
my $foo = "bar"
print "The magic word is $foo_for_you\n";
, Perl , , $foo_for_you, $foo _for_you ββ . , ? :
print "The magic word is $foobar\n";
, , $foo - :
print "The magic word is " . $foo . "_for_you\n";
printf "The magic word is %s_for_you\n", $foo;
print "The magic word is ${foo}_for_you\n";
, $foo::for::you ( $foo'for'you). Perl $you foo::for. , :
print "The magic word is " . $foo . "::for::you\n";
printf "The magic word is %d::for::you\n", $foo;
print "The magic word is ${foo}::for::you\n";
Namespaces are used to help keep variables in Perl modules from changing variables in your program. Imagine that you are calling a function in a Perl package and unexpectedly discover that the variable that you used in your program has changed.
Take a look at File :: Find and you will see the variables with the package namespace attached to them ( $File::Find::nameand $File::Find::dirtwo examples).
source
share