in reply to Re: Refactoring Perl #7 - Remove Assignments to Parameters
in thread Refactoring Perl #7 - Remove Assignments to Parameters
my $var = 'foo'; warn $var; # prints foo by_val( $var ); warn $var; # prints foo by_ref( \$var ); warn $var; # prints bar sub by_ref{ my $var_ref = shift; $$var_ref = 'bar'; } sub by_val{ my $var = shift; $var = 'bar'; }
My understanding was that this is PbV and PbR respectively. Your post suggests that Perl is always PbR, so does that mean that my pass by value example is just allowing me to fake PbV? Or is the difference more of a technical, low level detail?
perl -e 'split//,q{john hurl, pest caretaker}and(map{print @_[$_]}(joi +n(q{},map{sprintf(qq{%010u},$_)}(2**2*307*4993,5*101*641*5261,7*59*79 +*36997,13*17*71*45131,3**2*67*89*167*181))=~/\d{2}/g));'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Refactoring Perl #7 - Remove Assignments to Parameters
by ikegami (Patriarch) on Aug 23, 2007 at 15:28 UTC | |
by agianni (Hermit) on Aug 23, 2007 at 15:57 UTC |