: Tore Aursand wrote:
:
: > On Wed, 01 Oct 2003 13:41:02 +0100, Chris Smith wrote:
: >> Is there a nicer way of doing the following?
: >>
: >> $a = lc($a);
: >>
: >> Doesn't look "perlish" if you know what I mean.
: >
: > No. I don't know what you mean. What do you mean? Do you find solutions
: > like this one more "perlish"?
: >
: > $a =~ tr/A-Z/a-z/;
: >
: > If so, you shouldn't be using Perl.

:
: I'm talking more like:
:
: lc $a;
:
: And return the value in $a rather than $_
Do you mean you would like the lc() function to alter its argument
in-place? You can have that.
use subs 'lc';
sub lc {
my $arg = \( @_ ? $_[0] : $_ );
$$arg = CORE::lc $$arg;
}
$_ = 'HELLO, WORLD!';
print;
lc;
print;
Perl programmers tend to like functions that have minimal side-effects,
but the proposed function is nothing but a side-effect. To "look
perlish," a significant perlish quality is lost.
: $a=lc($a);
:
: is very BASIC-like if you know what I mean.
What language is it like if I do not know what you mean?
Readers of technical newsgroups appreciate precision. You might want to
avoid habitual use of imprecise language like "if you know what I mean."