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));'
In reply to Re^2: Refactoring Perl #7 - Remove Assignments to Parameters
by agianni
in thread Refactoring Perl #7 - Remove Assignments to Parameters
by agianni
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |