> Second, as it seems common for someone learning perl to expect
>
> $without_newline = chomp($previous_form);
This proposal seeks to make things more consistent, which is good, but
at the expense of being less usable, which is bad. For example, these:
chomp;
chomp(@file);
chomp($val = <$STDIN>);
Now become:
$_ = chomp;
@file = chomp(@file);
$val = chomp(<$STDIN>);
I don't particularly mind the last two - in fact they add some benefits
(like not modifying the original), which are nice to have. However, that
first one, frankly, drives me nuts.
I suggest a modification to this RFC: if chomp() is called without args,
it modifies $_ directly, consistent with its current implementation.
That way you can write:
while(chomp(<$STDIN>)) {
# do stuff with $_
}
or:
while(<$STDIN>) {
chomp;
# do stuff with $_
}
without being forced to write:
while($_ = chomp(<STDIN>)) {
# do stuff with $_
}
Wow, true TMTOWTDI! I like it.
-Nate