Re: Incrementing Strings

2001-06-27 Thread Jos Boumans
ok, long day, let me write it like it IS concider: if ('a' == 'b') { print "foo" } # this will print 'foo', seeing 'a' compared to 'b' yields '1' even in numeric context here (ie, the RETURN value of the compare, not the representation of the characters) sorry for the confusion and thanks for

Re: Incrementing Strings

2001-06-27 Thread Kevin Meltzer
On Wed, Jun 27, 2001 at 12:04:53PM -0400, Jeff 'japhy' Pinyan ([EMAIL PROTECTED]) spew-ed forth: > On Jun 27, Kevin Meltzer said: > > >On Wed, Jun 27, 2001 at 11:51:01AM -0400, Chas Owens ([EMAIL PROTECTED]) spew-ed >forth: > >> On 27 Jun 2001 17:45:18 +0200, Jos Boumans wrote: > >> > > How do

Re: Incrementing Strings

2001-06-27 Thread Jeff 'japhy' Pinyan
On Jun 27, Kevin Meltzer said: >On Wed, Jun 27, 2001 at 11:51:01AM -0400, Chas Owens ([EMAIL PROTECTED]) spew-ed >forth: >> On 27 Jun 2001 17:45:18 +0200, Jos Boumans wrote: >> > > How do you mean? >> > >> > concider: >> > if ('a' == 'b') { print "foo" } # this will print 'foo', seeing 'a' and

Re: Incrementing Strings

2001-06-27 Thread Kevin Meltzer
On Wed, Jun 27, 2001 at 11:51:01AM -0400, Chas Owens ([EMAIL PROTECTED]) spew-ed forth: > On 27 Jun 2001 17:45:18 +0200, Jos Boumans wrote: > > > How do you mean? > > > > concider: > > if ('a' == 'b') { print "foo" } # this will print 'foo', seeing 'a' and 'b' both >yield '1' in numeric > > con

Re: Incrementing Strings

2001-06-27 Thread Chas Owens
On 27 Jun 2001 17:45:18 +0200, Jos Boumans wrote: > > How do you mean? > > concider: > if ('a' == 'b') { print "foo" } # this will print 'foo', seeing 'a' and 'b' both >yield '1' in numeric > context here. You mean 0 not 1 don't you? > > however > > $x = 'a'; > print $x + 4; > > will print

Re: Incrementing Strings

2001-06-27 Thread Brett W. McCoy
On Wed, 27 Jun 2001, Pierre Smolarek wrote: > does this all mean that c++ is ACTUALLY D ? No, c++ is ACTUALLY a pain in the butt to code... :-) -- Brett http://www.chapelperilous.net/btfwk/ --

Re: Incrementing Strings

2001-06-27 Thread Jos Boumans
> How do you mean? concider: if ('a' == 'b') { print "foo" } # this will print 'foo', seeing 'a' and 'b' both yield '1' in numeric context here. however $x = 'a'; print $x + 4; will print '4'; Jos Boumans > Converting 'a' to a number gives 0. > > -- > Paul Johnson - [EMAIL PROTECTED] > htt

Re: Incrementing Strings

2001-06-27 Thread Pierre Smolarek
t; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, June 27, 2001 4:38 PM Subject: Re: Incrementing Strings > On Wed, Jun 27, 2001 at 06:21:30PM +0200, Paul Johnson ([EMAIL PROTECTED]) spew-ed forth: > > On Wed, Jun 27, 2001 at 11:07:12AM -0400, Kevin Meltzer wrote: > >

Re: Incrementing Strings

2001-06-27 Thread Kevin Meltzer
On Wed, Jun 27, 2001 at 06:21:30PM +0200, Paul Johnson ([EMAIL PROTECTED]) spew-ed forth: > On Wed, Jun 27, 2001 at 11:07:12AM -0400, Kevin Meltzer wrote: > > > > Is that the reason? I would think --'a' would be z, but that is my own > > internal logic :) > > But ++'z' isn't 'a'. No, it is aa,

Re: Incrementing Strings

2001-06-27 Thread Brett W. McCoy
On Wed, 27 Jun 2001, Paul Johnson wrote: > > Is that the reason? I would think --'a' would be z, but that is my own > > internal logic :) > > But ++'z' isn't 'a'. Technically, you can't do ++'z' because you are modifying a constant... but autoincrementing a variable whose value is 'z' will make

Re: Incrementing Strings

2001-06-27 Thread Brett W. McCoy
On Wed, 27 Jun 2001, Paul wrote: > The auto-decrement operator is not magical. The Camel Book adds that there are not any plans to make it magical. -- Brett http://www.chapelperilous.net/btfwk/ --

Re: Incrementing Strings

2001-06-27 Thread Paul Johnson
On Wed, Jun 27, 2001 at 11:07:12AM -0400, Kevin Meltzer wrote: > On Wed, Jun 27, 2001 at 10:55:54AM -0400, Jeff 'japhy' Pinyan ([EMAIL PROTECTED]) >spew-ed forth: > > On Jun 27, Nick Transier said: > > > > The perlop documentation says that ++ is magical for strings, but that -- > > isn't. The

Re: Incrementing Strings

2001-06-27 Thread Paul
--- Nick Transier <[EMAIL PROTECTED]> wrote: > If I define a variable as a string > my $var = "a"; > > I can get the increment to work > print ++$var; --> prints b > > but the decrement > print --$var --> prints -1 > > Why? and how can I dec

Re: Incrementing Strings

2001-06-27 Thread Kevin Meltzer
On Wed, Jun 27, 2001 at 10:55:54AM -0400, Jeff 'japhy' Pinyan ([EMAIL PROTECTED]) spew-ed forth: > On Jun 27, Nick Transier said: > > The perlop documentation says that ++ is magical for strings, but that -- > isn't. The reason is because there's not a clear-cut way of defining it. > > What is

Re: Incrementing Strings

2001-06-27 Thread Jeff 'japhy' Pinyan
On Jun 27, Nick Transier said: >If I define a variable as a string >my $var = "a"; > >I can get the increment to work >print ++$var; --> prints b > >but the decrement >print --$var --> prints -1 > >Why? and how can I decrement it? The perlop documentation says that ++ is magical for strings, but

Incrementing Strings

2001-06-27 Thread Nick Transier
If I define a variable as a string my $var = "a"; I can get the increment to work print ++$var; --> prints b but the decrement print --$var --> prints -1 Why? and how can I decrement it? Thanks, -Nick _ Get your FREE download of