Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Re: Re: style q: duplication? of variablesby bikeNomad (Priest) |
on Aug 14, 2001 at 19:10 UTC ( [id://104790]=note: print w/replies, xml ) | Need Help?? |
I definitely don't like it when in a language I can't see at the function call whether an argument might be changed. Well, you picked a trivial example (scalars, specifically strings). In much of the Perl code you'll see, references are being passed around anyway, since plain old scalars have limited usefulness. What you may want to do is to adopt a naming convention to signify subroutines that take scalar arguments and modify them. You note that this was a disadvantage of Ruby; but note that Ruby has a convention of using a trailing '!' sign to denote methods that modify value types (especially) in place (i.e. chomp!() vs. chomp()). Maybe your Perl code could do something similar (i.e. truncate() vs. truncated(), perhaps).
In Section
Seekers of Perl Wisdom
|
|