Re: interesting JAPH, how does this work?
On 10 Jan 2002 18:10:20 -0500, [EMAIL PROTECTED] (Michael R. Wolf) wrote: >[EMAIL PROTECTED] (Zentara) writes: > >> I get it, so "perl" equals 285075 in a base24 number >> system, with the alphabet as it's units. > >24? What's 24? There are _26_ letters in the alphabet! Or >was "24" a base _11_ number? And if so, what extra digit >were you using other than your fingers? :-) Damn it!! My mother always told me to remember my p's and q's. :-) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: interesting JAPH, how does this work?
[EMAIL PROTECTED] (Zentara) writes: > I get it, so "perl" equals 285075 in a base24 number > system, with the alphabet as it's units. 24? What's 24? There are _26_ letters in the alphabet! Or was "24" a base _11_ number? And if so, what extra digit were you using other than your fingers? :-) > For the sake of theoretical babbling, could this base24 > number system be used to perform math operations in perl? > Carry it to decimal points etc. Like perl.sdc ? For the sake of theoretical responses, here's the "Programming Perl" explanation: => The autoincrement operator has a little extra built-in magic => to it. If you increment a variable that is numeric, or that => has ever been used in a numeric context, you get a normal => increment. If, however, the variable has only been used in => string contexts since it was set, and has a value that is => not null and matches the pattern /^[a-zA-Z]*[0-9]*$/, the => increment is done as a string, preserving each character => within its range, with carry: => => print ++($foo = '99'); # prints '100' => print ++($foo = 'a0'); # prints 'a1' => print ++($foo = 'Az'); # prints 'Ba' => print ++($foo = 'zz'); # prints 'aaa' => => The autodecrement operator, however, is not magical. I guess by "within its range" implies 3 (not 2) ranges: [a-z] [A-Z] [0-9] -- Michael R. Wolf All mammals learn by playing! [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: interesting JAPH, how does this work?
> "Zentara" == Zentara <[EMAIL PROTECTED]> writes: Zentara> I get it, so "perl" equals 285075 in a base24 number system, Zentara> with the alphabet as it's units. There are only 24 letters in your alphabet? :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: interesting JAPH, how does this work?
Yes, well sort of, it can do whatever you want. Incrementing letters like the example is built in, but for what you are talking about you would need to build that functionality yourself. You could use the overload pragma (see perldoc overload) to override the built in operators and write your own addition and subtraction routines so that $a + $b added letters instead of number (or both letters and numbers). Rob -Original Message- From: zentara [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 10, 2002 3:51 PM To: [EMAIL PROTECTED] Subject: Re: interesting JAPH, how does this work? On Thu, 10 Jan 2002 12:11:53 -0500, [EMAIL PROTECTED] (Robert Hanson) wrote: >You can increment letters just like you increment numbers. >$x = "a"; >$x++; >print $x; # prints "b" > >And the letter "z" incremented becomes "aa". > >$x = "z"; >$x++; >print $x; # prints "aa" > >So here is the script... > >$A = "a"; # assign "a" to $A. >for(0..285074){$A++;} # increment $A 285,074 times >print"$A\n"; # prints the new value I get it, so "perl" equals 285075 in a base24 number system, with the alphabet as it's units. For the sake of theoretical babbling, could this base24 number system be used to perform math operations in perl? Carry it to decimal points etc. Like perl.sdc ? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: interesting JAPH, how does this work?
On Thu, 10 Jan 2002 12:11:53 -0500, [EMAIL PROTECTED] (Robert Hanson) wrote: >You can increment letters just like you increment numbers. >$x = "a"; >$x++; >print $x; # prints "b" > >And the letter "z" incremented becomes "aa". > >$x = "z"; >$x++; >print $x; # prints "aa" > >So here is the script... > >$A = "a"; # assign "a" to $A. >for(0..285074){$A++;} # increment $A 285,074 times >print"$A\n"; # prints the new value I get it, so "perl" equals 285075 in a base24 number system, with the alphabet as it's units. For the sake of theoretical babbling, could this base24 number system be used to perform math operations in perl? Carry it to decimal points etc. Like perl.sdc ? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: interesting JAPH, how does this work?
Readability wasn't a concern with making this obfu. I did want to show that it worked with "use strict;" so I put that on a seperate line. Original Monks post below. Joel Calaban on Monks #!c:\perl\perl.exe -w use strict; my $A="a";for(0..285074){$A++;}print"$A"; > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 10, 2002 9:47 AM > To: Hanson, Robert > Cc: [EMAIL PROTECTED]; 'zentara' > Subject: RE: interesting JAPH, how does this work? > > > > Try this: > > #!/opt/local/bin/perl > #!/usr/bin/perl > my $A="a"; > for(0..285074){ > $A++; > print" $A:"; > } > print"\n\n$A\n"; > > -- > This reemphasizes a mail I just read from someone on this > list about the need to write "clearly readable" codes. > > > > __ > > William Ampeh (x3939) > Federal Reserve Board > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: interesting JAPH, how does this work?
[EMAIL PROTECTED] wrote: > > Try this: > > #!/opt/local/bin/perl > #!/usr/bin/perl > my $A="a"; > for(0..285074){ > $A++; > print" $A:"; perhaps you should consider NOT printing that 285074 times? would kinda flood the term :) > } > print"\n\n$A\n"; > > -- > This reemphasizes a mail I just read from someone on this > list about the need to write "clearly readable" codes. > > __ > > William Ampeh (x3939) > Federal Reserve Board > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: interesting JAPH, how does this work?
Try this: #!/opt/local/bin/perl #!/usr/bin/perl my $A="a"; for(0..285074){ $A++; print" $A:"; } print"\n\n$A\n"; -- This reemphasizes a mail I just read from someone on this list about the need to write "clearly readable" codes. __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: interesting JAPH, how does this work?
C:\users>perl -e "$A=qq(a);for(0..285074){$A++}print qq($A\n);" perl C:\users>perl -e "$A=qq(a);for(0..28){$A++}print qq($A\n);" ad C:\users>perl -e "$A=qq(a);for(0..2){$A++}print qq($A\n);" d C:\users>perl -e "$A=qq(a);for(0..1){$A++}print qq($A\n);" c C:\users>perl -e "$A=qq(a);for(0){$A++}print qq($A\n);" b C:\users>perl -e "$A=qq(a);for(0..10){$A++}print qq($A\n);" l C:\users>perl -e "$A=qq(a);for(0..26){$A++}print qq($A\n);" ab C:\users> etc etc etc :-) Luke On Thu, 10 Jan 2002, zentara wrote: > Hi, > I saw this on perlmonks.org. > I can't understand how it works. > Can anyone enlighten me? > > #!/usr/bin/perl > my $A="a"; > for(0..285074){$A++;}print"$A\n"; > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: interesting JAPH, how does this work?
You can increment letters just like you increment numbers. For example: $x = "a"; $x++; print $x; # prints "b" And the letter "z" incremented becomes "aa". $x = "z"; $x++; print $x; # prints "aa" So here is the script... $A = "a"; # assign "a" to $A. for(0..285074){$A++;} # increment $A 285,074 times print"$A\n"; # prints the new value Rob -Original Message- From: zentara [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 10, 2002 12:01 PM To: [EMAIL PROTECTED] Subject: interesting JAPH, how does this work? Hi, I saw this on perlmonks.org. I can't understand how it works. Can anyone enlighten me? #!/usr/bin/perl my $A="a";for(0..285074){$A++;}print"$A\n"; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
interesting JAPH, how does this work?
Hi, I saw this on perlmonks.org. I can't understand how it works. Can anyone enlighten me? #!/usr/bin/perl my $A="a"; for(0..285074){$A++;}print"$A\n"; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]