> I'd've written that more like
> 
>     $data_axed = chop($var);
>     $charcount = chomp($var);
> 
> Or something.  People really do find those two functions confusing.
> Is this something we'd like to address by having versions that don't
> take LVALUES?

I don't know. It is true that this is somewhat confusing. 
 
> But people always think of it as working
> 
>     $newstring = chomp $oldstring;
> 
> where $oldstring is untouched, analogous to nearly all the
> other functions, like

Yeah, you're right. Again, it is confusing. However, there are some
benefits to the atomic version(s):

   while(<PASSWD>) {
       chomp;   # would have to be $_ = chomp
       ($user, $pass) = split ':';
   }

When you use defaults alot, it all seems really well designed. But if
you like to use your own values for $lines, it is more confusing.

I don't know of an easy solution. I don't think we should touch chomp or
chop. Maybe someone should write a module that offers alternate versions
for those that want them?

   use NonAtomicChomp qw(chomp);
   $newstring = chomp $oldstring;

(No, I don't think this is a good idea :-).

-Nate

Reply via email to