* Quantum Mechanic <[EMAIL PROTECTED]> [2004-04-19 23:09]: > --- "A. Pagaltzis" <[EMAIL PROTECTED]> wrote: > > my $amt_str = sprintf "%7.3f", $amt; > > for($amt_str) { chop if /\.\d\d0\z/ } > > Why would you do "for..chop" when you could do "s///"? > You're using an re either way? > > ;) > > ===== > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Quantum Mechanics: The dreams stuff is made of
Because I think chop if /\.\d\d0\z/; is clearer to read than s/(?<=\.\d\d)0\z//; or even (yuck!) s/(\.\d\d)0\z/$1/; The last one is even semantically different, even though it does the same thing. -- Regards, Aristotle "If you can't laugh at yourself, you don't take life seriously enough."