|
Poll :: Do you remember what the ^ operator stands for in Perl? |
Extends your pattern's legibility by permitting whitespace and comments. |
|
20% |
[ 1 ] |
Matches a non-digit character |
|
0% |
[ 0 ] |
Quotes the next metacharacter |
|
0% |
[ 0 ] |
Updates your address book w/ Larry Wall's e-mail address |
|
40% |
[ 2 ] |
Form feed |
|
0% |
[ 0 ] |
Matches the beginning of the line |
|
40% |
[ 2 ] |
Treats string as single line |
|
0% |
[ 0 ] |
Changes the word furniture into the word Furniture |
|
0% |
[ 0 ] |
|
Total Votes : 5 |
|
Author |
Message |
verto
Senior WebHelper
Joined: 14 Jan 2002
Posts: 220
Location: Cambridge MA USA
|
Posted:
Wed Jul 03, 2002 6:55 pm (21 years, 9 months ago) |
|
I couldn't find a better place to post this (such as a board for a specific language) because I don't know the answer to my question yet, doh!
On a JavaScript certification test I've taken a few times, i noticed I kept missing various questions related to the 'carat' operator (i.e., ^ ). In JavaScript, it's used for XOR bitwise operations (logical 'exclusive' OR), but something in me kept wanting to use it as a 'power' (exponentiation) operator (i.e., x ^ y = x to the yth power).
I've finally gotten the ^ somewhat firmly associated w/ XOR in JavaScript, but can't, for the life of me, remember in which (if any) language it's used for exponentiation. I tried searching online for its usage in different languages for exponentiation, but it's taking too long I'm afraid. So far, I've found it used for XOR in C ...
There must be some programmers out there who already know/remember this! |
________________________________ >>>>>>>>>>>>>
GENERAL DISCLAIMER:This disclaimer may be void where null in all cases unless explicitly not unprohibited or (p)re-exclusively assigned by sufficient presedimentation on behalf of every non-interested party to wit (or so it was said).
:::
.: :. . : :....: :.: .: :. verto .: :. . : :....: :.: .: :.
Last edited by verto on Fri Jul 05, 2002 8:59 pm, edited 1 time in total |
|
|
|
general-chat.com
Junior WebHelper
Joined: 25 Jun 2002
Posts: 10
Location: uk
|
Posted:
Wed Jul 03, 2002 10:04 pm (21 years, 9 months ago) |
|
|
|
|
Garth Farley
WebHelper
Joined: 08 Jan 2002
Posts: 69
Location: Ireland
|
Posted:
Thu Jul 04, 2002 12:42 am (21 years, 9 months ago) |
|
Well I can confirm that it isn't used by Perl or PHP or C or C++ or Java.
Yeah this is beginning to get to me too.
By the way, as the Mathematician that I am, I must clarify the difference betweem exponentiation and power. Exponent is 3 X 10**-4. Power is simply 3**-4
Where ** stands for power of.
Garth Farley |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Thu Jul 04, 2002 8:50 am (21 years, 9 months ago) |
|
Well, actually, I'm sure I've seen ^ used in Perl scripts...
For example, when you configure an email address in FormMail, there's a ^ in front of it. |
________________________________
|
|
|
|
Garth Farley
WebHelper
Joined: 08 Jan 2002
Posts: 69
Location: Ireland
|
Posted:
Thu Jul 04, 2002 11:44 pm (21 years, 9 months ago) |
|
Daniel wrote: | Well, actually, I'm sure I've seen ^ used in Perl scripts...
|
Oh yeah, the carat is used for XORing bits in a few languages, as well as Perl RegExps.
Garth Farley |
|
|
|
|
verto
Senior WebHelper
Joined: 14 Jan 2002
Posts: 220
Location: Cambridge MA USA
|
Posted:
Fri Jul 05, 2002 2:45 pm (21 years, 9 months ago) |
|
Garth wrote: | "Oh yeah, the carat is used for XORing bits in a few languages, as well as Perl RegExps." |
Well you're right on that, and thanks for the bit about exponentiation (i'm beginning to think that this's maybe one reason i never felt right about logarithms when i took math in High School -- i never really got down the differences in all the terminology. Sure, logs are really the same as exponents -- or are they? )
i think i got the answer i was looking for at another site where i posted this. The server for it's down at the moment, so i can't post the replies, but one was to the effect that ^ is used for power ops in sed and VBS (which i think maybe is the same as VBScript?).
Some of my earliest programming was done in a version of Quick Basic that Microsoft sold as an IDE back in the mid-80's before they started bundling a pared-down version of it with MS-DOS, and i'm still guessing that this's where i got that usage from. I haven't confirmed this yet for Quick Basic or Sed (which i think actually uses it in RegExps in same way as Perl), but here's what i found online for VBScript:
Quote: | "The ^ operator, which is sometimes called "hat", is used to raise a number to a power." |
|
________________________________ >>>>>>>>>>>>>
GENERAL DISCLAIMER:This disclaimer may be void where null in all cases unless explicitly not unprohibited or (p)re-exclusively assigned by sufficient presedimentation on behalf of every non-interested party to wit (or so it was said).
:::
.: :. . : :....: :.: .: :. verto .: :. . : :....: :.: .: :. |
|
|
|
Garth Farley
WebHelper
Joined: 08 Jan 2002
Posts: 69
Location: Ireland
|
Posted:
Wed Jul 10, 2002 9:18 pm (21 years, 9 months ago) |
|
I thought that was ** in Perl and PHP. Not C anyway, it needs the pow() function. No idea about Java. So it must be different for each language.
Garth Farley |
|
|
|
|
verto
Senior WebHelper
Joined: 14 Jan 2002
Posts: 220
Location: Cambridge MA USA
|
Posted:
Fri Jul 12, 2002 11:28 pm (21 years, 9 months ago) |
|
well thanks for thinking about it, Garth |
________________________________ >>>>>>>>>>>>>
GENERAL DISCLAIMER:This disclaimer may be void where null in all cases unless explicitly not unprohibited or (p)re-exclusively assigned by sufficient presedimentation on behalf of every non-interested party to wit (or so it was said).
:::
.: :. . : :....: :.: .: :. verto .: :. . : :....: :.: .: :. |
|
|
|
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.260429 seconds :: 21 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
|