chunlou has asked for the wisdom of the Perl Monks concerning the following question:
Does that mean $p'a is a namespace thing? I don't quite comprehend what scope $p'a is. Is it the same thing as $package::var_or_func?#! /usr/local/bin/perl -w use strict ; # ---------------------------------------------------------- my $a = "this\n"; sub this {$p'a = $a; print $p::a;} sub that {$p::a = "that\n"; print $p'a;} sub more {$p::a = "more\n"; print $a;} this(); # print "this" that(); # print "that" more(); # print "this" print $p'a; # print "more" print $p::a; # print "more" print $a; # print "this" # ---------------------------------------------------------- sub a'this {$p'u'a = "mooo\n"; print $p::u::a;} a::this(); # print "mooo" print $p'u'a; # print "mooo" # ---------------------------------------------------------- sub a::that {$p't'u = "wwoo\n"; return sub{print $p't'u}} $a'that = a'that(); $a'that->(); # print "wwoo" $a'that = a'that(); $p::t::u = "booo\n"; $a'that->(); # print "booo"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: what's $p'a=$a mean?
by Ovid (Cardinal) on Jun 12, 2003 at 22:19 UTC | |
by chunlou (Curate) on Jun 12, 2003 at 22:36 UTC | |
by sauoq (Abbot) on Jun 12, 2003 at 23:14 UTC | |
by Ovid (Cardinal) on Jun 12, 2003 at 23:12 UTC | |
by Oberon (Monk) on Jun 13, 2003 at 20:01 UTC | |
by demerphq (Chancellor) on Jun 14, 2003 at 22:41 UTC | |
by Mr. Muskrat (Canon) on Jun 13, 2003 at 13:02 UTC |