Re: fractional cents

2004-04-21 Thread A. Pagaltzis
* Bernie Cosell <[EMAIL PROTECTED]> [2004-04-22 00:02]: > On 21 Apr 2004 at 22:55, A. Pagaltzis wrote: > > If you do this by looking at $amt, then your method must be > > mathematical, because chopping characters in the string > > representation of the unrounded $amt might occasionally lead to > >

Re: fractional cents

2004-04-21 Thread Bernie Cosell
On 21 Apr 2004 at 22:55, A. Pagaltzis wrote: > * John Douglas Porter <[EMAIL PROTECTED]> [2004-04-20 08:39]: > > It seems to me that the precision desired should depend on > > context, and nothing else. And that being the case... > > > > printf $fractional_cents ? '%7.3f' : '%7.sf', $amt; > >

Re: Padding a length of string

2004-04-21 Thread A. Pagaltzis
* Uri Guttman <[EMAIL PROTECTED]> [2004-04-20 08:07]: > and no one found one of the faster methods: > > my $padded = substr( $in . $c x $pad_len, 0, $pad_len ) ; I did. Unfortunately, I misread the spec and thought it would be a problem that it also chops an $in longer than $pad_len down to $pad_

Re: fractional cents

2004-04-21 Thread A. Pagaltzis
* John Douglas Porter <[EMAIL PROTECTED]> [2004-04-20 08:39]: > It seems to me that the precision desired should depend on > context, and nothing else. And that being the case... > > printf $fractional_cents ? '%7.3f' : '%7.sf', $amt; > > irrespective of the value of $amt. Why is this not rig

Re: AW: mini-golf: first differing position

2004-04-21 Thread Xavier Noria
On Apr 21, 2004, at 10:27, Xavier Noria wrote: Sure thank you, then looks like {$x ne$y&&$x=~/./sg&$y=~/\G\Q$&/g&&redo;$n=$-[0]} is the shortest solution so far (49). Just for the record, using the trick in the last post by Terje we get 48: {$x ne$y&&$x=~/./sg&$y=~/\G\Q$&/g&&redo;($n)[

Re: xor of unicode strings

2004-04-21 Thread Yitzchak Scott-Thoennes
On Wed, Apr 21, 2004 at 07:37:42AM -0700, Yitzchak Scott-Thoennes <[EMAIL PROTECTED]> wrote: > On Wed, 21 Apr 2004, Bernie Cosell wrote: > > > I'm not sure if this is 'fun', but it might be at least curious: I don't > > have a UTF-8 system handy to try, but I'm wondering: what happens with > > th

Re: xor of unicode strings

2004-04-21 Thread Yitzchak Scott-Thoennes
On Wed, 21 Apr 2004, Bernie Cosell wrote: > I'm not sure if this is 'fun', but it might be at least curious: I don't > have a UTF-8 system handy to try, but I'm wondering: what happens with > the string-xor operator on UTF-8 strings. It obviously cannot work byte- > by-byte, but it seems like it

xor of unicode strings

2004-04-21 Thread Bernie Cosell
I'm not sure if this is 'fun', but it might be at least curious: I don't have a UTF-8 system handy to try, but I'm wondering: what happens with the string-xor operator on UTF-8 strings. It obviously cannot work byte- by-byte, but it seems like it is going to be a bit tricky figuring out what yo

RE: AW: mini-golf: first differing position

2004-04-21 Thread Terje Kristensen
and even 24 $_=$x^$y;($n)[EMAIL PROTECTED]/^\0+/ ($n)[EMAIL PROTECTED]($x^$y)=~/^\0*/ Terje > -Original Message- > From: Winter Christian [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 21, 2004 10:09 AM > To: [EMAIL PROTECTED] > Subject: AW: AW: mini-golf: first differing position >

Re: AW: mini-golf: first differing position

2004-04-21 Thread Xavier Noria
On Apr 21, 2004, at 10:04, Yitzchak Scott-Thoennes wrote: On Wed, Apr 21, 2004 at 09:44:54AM +0200, Xavier Noria <[EMAIL PROTECTED]> wrote: Good. With a little modification we get 26 if this is right: $_=$x^$y;$n=$-[0]if/[^\0]/ $x = "abc"; $y = "abc\0\0\0"; gives undef instead of the require

AW: AW: mini-golf: first differing position

2004-04-21 Thread Winter Christian
Xavier Noria wrote: > > On Apr 21, 2004, at 8:40, Winter Christian wrote: > > Good. With a little modification we get 26 if this is right: > > $_=$x^$y;$n=$-[0]if/[^\0]/ or even get a 25: $_=$x^$y;($n)[EMAIL PROTECTED]/[^\0]/ -Christian

Re: AW: mini-golf: first differing position

2004-04-21 Thread Yitzchak Scott-Thoennes
On Wed, Apr 21, 2004 at 09:44:54AM +0200, Xavier Noria <[EMAIL PROTECTED]> wrote: > Good. With a little modification we get 26 if this is right: > > $_=$x^$y;$n=$-[0]if/[^\0]/ $x = "abc"; $y = "abc\0\0\0"; gives undef instead of the required 3 On Wed, Apr 21, 2004 at 07:48:57AM +0200, Xavier

Re: AW: mini-golf: first differing position

2004-04-21 Thread Xavier Noria
On Apr 21, 2004, at 8:40, Winter Christian wrote: No, this one also counts similarities after the first differing character. $x = "abcfff"; $y = "abcggg"; correctly gives 3, but just try out $x = "abcfff"; $y = "abcgff"; which gives you 5 because of the matching "f"s. This way it should work: $_