in reply to Efficiency of $$var, ${$var}
#!/usr/bin/perl $a = "foo"; $b = \$a; print "b : $$b\n"; print "b2 : ${$b}\n";
perl -MO=Deparse,-p test_ref.pl ($a = 'foo'); ($b = (\$a)); print("b : $$b\n"); print("b2 : ${$b;}\n"); test_ref.pl syntax OK
perl -Dt test_ref.pl (test_ref.pl:0) enter (test_ref.pl:0) nextstate (test_ref.pl:3) const(PV("foo"\0)) (test_ref.pl:3) gvsv(main::a) (test_ref.pl:3) sassign (test_ref.pl:3) nextstate (test_ref.pl:4) gvsv(main::a) (test_ref.pl:4) srefgen (test_ref.pl:4) gvsv(main::b) (test_ref.pl:4) sassign (test_ref.pl:4) nextstate (test_ref.pl:7) pushmark (test_ref.pl:7) const(PV("b : "\0)) (test_ref.pl:7) gvsv(main::b) (test_ref.pl:7) rv2sv (test_ref.pl:7) concat (test_ref.pl:7) const(PV("\n"\0)) (test_ref.pl:7) concat (test_ref.pl:7) print b : foo (test_ref.pl:7) nextstate (test_ref.pl:9) pushmark (test_ref.pl:9) const(PV("b2 : "\0)) (test_ref.pl:9) gvsv(main::b) (test_ref.pl:9) rv2sv (test_ref.pl:9) concat (test_ref.pl:9) const(PV("\n"\0)) (test_ref.pl:9) concat (test_ref.pl:9) print b2 : foo (test_ref.pl:9) leave
(test_ref.pl:4) nextstate (test_ref.pl:7) nextstate (test_ref.pl:7) pushmark (test_ref.pl:9) pushmark (test_ref.pl:7) const(PV("b : "\0)) (test_ref.pl:9) const(PV("b2 : " +\0)) (test_ref.pl:7) gvsv(main::b) (test_ref.pl:9) gvsv(main::b) (test_ref.pl:7) rv2sv (test_ref.pl:9) rv2sv (test_ref.pl:7) concat (test_ref.pl:9) concat (test_ref.pl:7) const(PV("\n"\0)) (test_ref.pl:9) const(PV("\n"\0) +) (test_ref.pl:7) concat (test_ref.pl:9) concat (test_ref.pl:7) print (test_ref.pl:9) print b : foo b2 : foo
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Efficiency of $$var, ${$var}
by RhetTbull (Curate) on Aug 20, 2001 at 20:18 UTC |