
counting differently
This is a multi-part message in MIME format.
--===============0161218104==
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_001D_01C3F9F2.AB0BE070"
This is a multi-part message in MIME format.
------=_NextPart_000_001D_01C3F9F2.AB0BE070
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Is there a way to force a variable to walk through the alphabet the way =
it can numbers?
ie: for numbers: $k=3D0; $k=3D$k+1; would give you 1
for letters $k=3D'a'; $k=3D$k+1; this won't give you 'b'; but is there =
any way of doing this that will?
------=_NextPart_000_001D_01C3F9F2.AB0BE070
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Is there a way to force a variable to =
walk through
the alphabet the way it can numbers?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>ie: for numbers: $k=3D0; =
$k=3D$k+1; would give
you 1</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>for letters $k=3D'a'; $k=3D$k+1; this =
won't give you
'b'; but is there any way of doing this that =
will?</FONT></DIV></BODY></HTML>
------=_NextPart_000_001D_01C3F9F2.AB0BE070--
--===============0161218104==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0161218104==--
Re: counting differently
cliff [at] globalmagic.com wrote:
>Is there a way to force a variable to walk through the alphabet the way it can numbers?
>
>ie: for numbers: $k=0; $k=$k+1; would give you 1
>
>for letters $k='a'; $k=$k+1; this won't give you 'b'; but is there any way of doing this that will?
>
>
>----------------------------------------------------------- -------------
>
>_______________________________________________
>ActivePerl mailing list
>ActivePerl [at] listserv.ActiveState.com
>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
root [at] www:~# perl -e "for('a'...'z') { print }"
abcdefghijklmnopqrstuvwxyzroot [at] www:~#
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: counting differently
cliff [at] globalmagic.com wrote:
> Is there a way to force a variable to walk through the alphabet the way
> it can numbers?
>
> ie: for numbers: $k=0; $k=$k+1; would give you 1
>
> for letters $k='a'; $k=$k+1; this won't give you 'b'; but is there any
> way of doing this that will?
>
>
> ------------------------------------------------------------ ------------
$k = 'a';
$k = chr(ord($k)+1);
$k will now contain 'b'. This works for ASCII, and English. No
promises for Unicode or other languages. This actaully walks the ASCII
sequence of characters, so the character after 'z' will be '{'.
Michael Koehn
Bergen County Schools
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: counting differently
This is a multi-part message in MIME format.
--===============0826494859==
content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C3FA23.EC774578"
This is a multi-part message in MIME format.
------_=_NextPart_001_01C3FA23.EC774578
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Cliff,
maybe as a Perl (but not programming) novice I am missing your point / =
application, but one could of course create an array [at] letter =3D (a..z) =
and walk through that, or if you are into Object Orientation create a =
letter class with a next() member function that knows the alphabet.
By the way, a question of mine: could one overload the ++ operator =
(which I like better than Cliff's '+ 1') instead of this next() above, =
by the way, such that
$letter =3D 'a';
$letter++ gives you 'b'? I guess you ned to hack the code for that? =
Far-fetched perhaps... Oh well.
Cheers, Pim
-----Original Message-----
From: cliff [at] globalmagic.com [mailto:cliff [at] globalmagic.com]
Sent: 23 February 2004 14:52
To: activeperl [at] listserv.ActiveState.com
Subject: counting differently
Is there a way to force a variable to walk through the alphabet the way =
it can numbers?
ie: for numbers: $k=3D0; $k=3D$k+1; would give you 1
for letters $k=3D'a'; $k=3D$k+1; this won't give you 'b'; but is there =
any way of doing this that will?
------_=_NextPart_001_01C3FA23.EC774578
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1226" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial>
<DIV><SPAN class=3D263283715-23022004><FONT face=3DTahoma><FONT =
color=3D#0000ff><FONT
size=3D2><SPAN
class=3D421173915-23022004>Cliff,</SPAN></FONT></FONT></FONT></SPAN></DIV=
>
<DIV><SPAN class=3D263283715-23022004><FONT face=3DTahoma><FONT =
color=3D#0000ff><FONT
size=3D2><SPAN
class=3D421173915-23022004></SPAN></FONT></FONT></FONT></SPAN> </DIV=
>
<DIV><SPAN class=3D263283715-23022004><FONT><FONT><SPAN
class=3D421173915-23022004></SPAN><FONT face=3DTahoma><FONT =
color=3D#0000ff><FONT
size=3D2>maybe <SPAN class=3D421173915-23022004>as a Perl (but not =
programming)
novice </SPAN>I am missing your point / application, but <SPAN
class=3D421173915-23022004>one </SPAN>could of course create an array =
[at] letter =3D
(a..z) and walk through that, <SPAN class=3D421173915-23022004>or =
if you are
into Object Orientation </SPAN>creat<SPAN =
class=3D421173915-23022004>e</SPAN>
a <SPAN class=3D421173915-23022004>letter class with a
</SPAN>next() <SPAN class=3D421173915-23022004>member
</SPAN>function <SPAN class=3D421173915-23022004>that knows the
alphabet.</SPAN></FONT></FONT></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D263283715-23022004><FONT><FONT><FONT =
face=3DTahoma><FONT
color=3D#0000ff><FONT size=3D2><SPAN
class=3D421173915-23022004></SPAN></FONT></FONT></FONT></FONT></FONT></SP=
AN> </DIV>
<DIV><SPAN class=3D263283715-23022004><FONT><FONT><FONT =
face=3DTahoma><FONT
color=3D#0000ff><FONT size=3D2><SPAN class=3D421173915-23022004>By the =
way, a question
of mine: could one overload the ++ operator (which I like better =
than
Cliff's '+ 1') instead of this next() above, by the way, such
that</SPAN></FONT></FONT></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D263283715-23022004><FONT><FONT><FONT =
face=3DTahoma><FONT
color=3D#0000ff><FONT size=3D2><SPAN class=3D421173915-23022004>$letter =
=3D
'a';</SPAN></FONT></FONT></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D263283715-23022004><FONT><FONT><FONT =
face=3DTahoma><FONT
color=3D#0000ff><FONT size=3D2><SPAN =
class=3D421173915-23022004>$letter++ gives you
'b'? I guess you ned to hack the code for that? Far-fetched
perhaps... Oh =
well.</SPAN></FONT></FONT></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D263283715-23022004><FONT><FONT><FONT =
face=3DTahoma><FONT
color=3D#0000ff><FONT size=3D2><SPAN
class=3D421173915-23022004></SPAN></FONT></FONT></FONT></FONT></FONT></SP=
AN> </DIV>
<DIV><FONT face=3DTahoma><SPAN class=3D263283715-23022004><FONT =
face=3DArial
color=3D#0000ff size=3D2>Cheers, =
Pim</FONT></SPAN></FONT></DIV></FONT></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma
size=3D2>-----Original Message-----<BR><B>From:</B> =
cliff [at] globalmagic.com
[mailto:cliff [at] globalmagic.com]<BR><B>Sent:</B> 23 February 2004
14:52<BR><B>To:</B> =
activeperl [at] listserv.ActiveState.com<BR><B>Subject:</B>
counting differently<BR><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Is there a way to force a variable to =
walk
through the alphabet the way it can numbers?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>ie: for numbers: $k=3D0; =
$k=3D$k+1; would give
you 1</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>for letters $k=3D'a'; $k=3D$k+1; this =
won't give you
'b'; but is there any way of doing this that
will?</FONT></DIV></BLOCKQUOTE></BODY></HTML>
------_=_NextPart_001_01C3FA23.EC774578--
--===============0826494859==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0826494859==--
RE: counting differently
This is a multi-part message in MIME format.
--===============0433304847==
content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C3FA23.D50D2641"
This is a multi-part message in MIME format.
------_=_NextPart_001_01C3FA23.D50D2641
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
An easy way
Define an array with the alphabet
[at] alphabet=3D("a","b",...)
$i=3D0
$temp=3D$alphabet[$i] "meaning $temp=3D"a"
$temp=3D$alphabet[$i+1] will now be "b"
-----Original Message-----
From: cliff [at] globalmagic.com [mailto:cliff [at] globalmagic.com]
Sent: Monday, February 23, 2004 6:52 AM
To: activeperl [at] listserv.ActiveState.com
Subject: counting differently
Is there a way to force a variable to walk through the alphabet the way =
it can numbers?
ie: for numbers: $k=3D0; $k=3D$k+1; would give you 1
for letters $k=3D'a'; $k=3D$k+1; this won't give you 'b'; but is there =
any way of doing this that will?
------_=_NextPart_001_01C3FA23.D50D2641
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><SPAN class=3D246514015-23022004><FONT face=3DArial color=3D#800000 =
size=3D2>An
easy way </FONT></SPAN></DIV>
<DIV><SPAN class=3D246514015-23022004></SPAN> </DIV>
<DIV><SPAN class=3D246514015-23022004><FONT face=3DArial color=3D#800000 =
size=3D2>Define
an array with the alphabet</FONT></SPAN></DIV>
<DIV><SPAN class=3D246514015-23022004><FONT face=3DArial color=3D#800000 =
size=3D2> [at] alphabet=3D("a","b",...)</FONT></SPAN></DIV>
<DIV><SPAN class=3D246514015-23022004><FONT face=3DArial color=3D#800000 =
size=3D2>$i=3D0</FONT></SPAN></DIV>
<DIV><SPAN class=3D246514015-23022004><FONT face=3DArial color=3D#800000 =
size=3D2>$temp=3D$alphabet[$i] "meaning =
$temp=3D"a"</FONT></SPAN></DIV>
<DIV><SPAN class=3D246514015-23022004><FONT face=3DArial color=3D#800000 =
size=3D2>$temp=3D$alphabet[$i+1] will now be "b"</FONT></SPAN></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma
size=3D2>-----Original Message-----<BR><B>From:</B> =
cliff [at] globalmagic.com
[mailto:cliff [at] globalmagic.com]<BR><B>Sent:</B> Monday, February 23, =
2004 6:52
AM<BR><B>To:</B> =
activeperl [at] listserv.ActiveState.com<BR><B>Subject:</B>
counting differently<BR><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Is there a way to force a variable to =
walk
through the alphabet the way it can numbers?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>ie: for numbers: $k=3D0; =
$k=3D$k+1; would give
you 1</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>for letters $k=3D'a'; $k=3D$k+1; this =
won't give you
'b'; but is there any way of doing this that
will?</FONT></DIV></BLOCKQUOTE></BODY></HTML>
------_=_NextPart_001_01C3FA23.D50D2641--
--===============0433304847==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0433304847==--
Re: counting differently
intertwingled wrote:
> cliff [at] globalmagic.com wrote:
>
>> Is there a way to force a variable to walk through the alphabet the
>> way it can numbers?
>>
>> ie: for numbers: $k=0; $k=$k+1; would give you 1
>>
>> for letters $k='a'; $k=$k+1; this won't give you 'b'; but is there
>> any way of doing this that will?
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> _______________________________________________
>> ActivePerl mailing list
>> ActivePerl [at] listserv.ActiveState.com
>> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>>
> root [at] www:~# perl -e "for('a'...'z') { print }"
> abcdefghijklmnopqrstuvwxyzroot [at] www:~#
>
>
Actually, also:
root [at] www:~# perl -e "for('a'..'z') { print }"
abcdefghijklmnopqrstuvwxyzroot [at] www:~#
... and ... are slightly different operators.
Tony
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: counting differently
cliff [at] globalmagic.com wrote:
>
> Is there a way to force a variable to walk through the alphabet the
> way it can numbers?
>
> ie: for numbers: $k=0; $k=$k+1; would give you 1
>
> for letters $k='a'; $k=$k+1; this won't give you 'b'; but is there
> any way of doing this that will?
But ++$a will, because it is magic in this context. (See 'perldoc
perlop', "Auto-increment and Auto-decrement").
For example:
for ($i = 'a'; $i ne 'zzz'; ++$i) { print "$i\n"; }
Or
print "$_\n" for ('a'..'z);
HTH
--
Brian Raven
------------------------------------------------------------ -----------
The information contained in this e-mail is confidential and solely
for the intended addressee(s). Unauthorised reproduction, disclosure,
modification, and/or distribution of this email may be unlawful. If you
have received this email in error, please notify the sender immediately
and delete it from your system. The views expressed in this message
do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary companies.
------------------------------------------------------------ -----------
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: counting differently
-----Original Message-----
From: activeperl-bounces [at] listserv.ActiveState.com
[mailto:activeperl-bounces [at] listserv.ActiveState.com] On Behalf Of Michael
Koehn
Sent: Monday, February 23, 2004 9:41 AM
To: activeperl [at] listserv.ActiveState.com
Subject: Re: counting differently
cliff [at] globalmagic.com wrote:
> Is there a way to force a variable to walk through the alphabet the
> way
> it can numbers?
>
> ie: for numbers: $k=0; $k=$k+1; would give you 1
>
> for letters $k='a'; $k=$k+1; this won't give you 'b'; but is there any
> way of doing this that will?
>
>
> ------------------------------------------------------------ ----------
> --
$k = 'a';
$k = chr(ord($k)+1);
$k will now contain 'b'. This works for ASCII, and English. No
promises for Unicode or other languages. This actaully walks the ASCII
sequence of characters, so the character after 'z' will be '{'.
Michael Koehn
Bergen County Schools
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Another way that works,
$k = 'a';
$k++;
Later,
Matt
Matt Ross
Motorola
Configuration Management ePIMS
Wk: 817.245.6540
2 way pager: 888.468.0815
E-mail: Matt.Ross [at] motorola.com
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: counting differently
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--===============1226866364==
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C3FA24.5C186498"
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C3FA24.5C186498
Content-Type: text/plain
Use the prefix operator:
$ perl -e '$x = "a"; print ++$x, "\n";'
b
-----Original Message-----
From: cliff [at] globalmagic.com [mailto:cliff [at] globalmagic.com]
Sent: Monday, February 23, 2004 8:52 AM
To: activeperl [at] listserv.ActiveState.com
Subject: counting differently
Is there a way to force a variable to walk through the alphabet the way it
can numbers?
ie: for numbers: $k=0; $k=$k+1; would give you 1
for letters $k='a'; $k=$k+1; this won't give you 'b'; but is there any way
of doing this that will?
This electronic message contains information, which may be confidential,
privileged or otherwise protected from disclosure. The information is
intended to be used solely by the recipient(s) named. If you are not an
intended recipient, be aware that any review, disclosure, copying,
distribution or use of this message or its contents is prohibited. If you
have received this message in error, please notify the sender and delete
this message from your system. Employees of the company are prohibited from
making defamatory statements and from infringing copyright or any other
legal right. Any such communication or infringement is contrary to company
policy and outside the scope of employment.
------_=_NextPart_001_01C3FA24.5C186498
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Message</TITLE>
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><SPAN class=3D177214615-23022004><FONT face=3DArial size=3D2>Use =
the prefix
operator:</FONT></SPAN></DIV>
<DIV><SPAN class=3D177214615-23022004><FONT face=3DArial
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D177214615-23022004><FONT face=3DArial size=3D2>$ =
perl -e '$x =3D "a";
print ++$x, "\n";'<BR>b<BR></FONT></SPAN></DIV>
<DIV><SPAN class=3D177214615-23022004><FONT face=3DArial
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D177214615-23022004><FONT face=3DArial
size=3D2></FONT></SPAN> </DIV>
<DIV></DIV>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr =
align=3Dleft><FONT face=3DTahoma
size=3D2>-----Original Message-----<BR><B>From:</B> =
cliff [at] globalmagic.com
[mailto:cliff [at] globalmagic.com] <BR><B>Sent:</B> Monday, February 23, =
2004 8:52
AM<BR><B>To:</B> activeperl [at] listserv.ActiveState.com<BR><B>Subject:</B> =
counting
differently<BR><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Is there a way to force a variable to =
walk through
the alphabet the way it can numbers?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>ie: for numbers: $k=3D0; =
$k=3D$k+1; would give
you 1</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>for letters $k=3D'a'; $k=3D$k+1; this =
won't give you
'b'; but is there any way of doing this that =
will?</FONT></DIV></BODY></HTML>
<BR>
<BR>
<P><B><FONT SIZE=3D2 FACE=3D"Arial">This electronic message contains =
information, which may be confidential, privileged or otherwise =
protected from disclosure. The information is intended to be used =
solely by the recipient(s) named. If you are not an intended =
recipient, be aware that any review, disclosure, copying, distribution =
or use of this message or its contents is prohibited. If you have =
received this message in error, please notify the sender and delete =
this message from your system. Employees of the company are prohibited =
from making defamatory statements and from infringing copyright or any =
other legal right. Any such communication or infringement is contrary =
to company policy and outside the scope of employment.</FONT></B></P>
<BR>
------_=_NextPart_001_01C3FA24.5C186498--
--===============1226866364==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1226866364==--
RE: counting differently
This is a multi-part message in MIME format.
--===============1972395435==
content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C3FA24.9041F7EB"
This is a multi-part message in MIME format.
------_=_NextPart_001_01C3FA24.9041F7EB
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Sure. Start with the Ascii value of the letter, add one, then convert back =
to letter.
for ($i =3D ord('a'); $i <=3D ord('z'); $i++)
{
print chr($i) . "\n";
}
Donald C. Stephens
Associate Software Engineer
Analytics Prototyping and Scientific Programming
Moody's KMV
Tel: 212.553.1346
Fax: 574.472.5990
-----Original Message-----
From: cliff [at] globalmagic.com [mailto:cliff [at] globalmagic.com]
Sent: Monday, February 23, 2004 9:52 AM
To: activeperl [at] listserv.ActiveState.com
Subject: counting differently
Is there a way to force a variable to walk through the alphabet the way it =
can numbers?
ie: for numbers: $k=3D0; $k=3D$k+1; would give you 1
for letters $k=3D'a'; $k=3D$k+1; this won't give you 'b'; but is there any =
way of doing this that will?
-----------
The information contained in this e-mail message, and any attachment, is co=
nfidential and for use solely by the intended recipient. If you have recei=
ved this message in error, please delete this message immediately. Althoug=
h Moody's KMV makes every effort to protect its computing environment from =
malicious code, Moody's KMV is not responsible for any virus or other type =
of suspect code that may be transferred via this e-mail message.
------_=_NextPart_001_01C3FA24.9041F7EB
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Diso-8859-=
1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><SPAN class=3D910244015-23022004><FONT face=3DArial color=3D#0000ff si=
ze=3D2>Sure.
Start with the Ascii value of the letter, add one, then convert back to
letter.</FONT></SPAN></DIV>
<DIV><SPAN class=3D910244015-23022004><FONT face=3DArial color=3D#0000ff
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D910244015-23022004><SPAN class=3D986164115-23022004><FON=
T
face=3DArial color=3D#0000ff size=3D2>for ($i =3D ord('a'); $i <=3D ord(=
'z');
$i++)</FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=3D910244015-23022004><SPAN class=3D986164115-23022004><FON=
T
face=3DArial color=3D#0000ff size=3D2>{</FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=3D910244015-23022004><SPAN
class=3D986164115-23022004> <FONT face=3DArial color=3D#0=
000ff
size=3D2>print chr($i) . "\n";</FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=3D910244015-23022004><SPAN class=3D986164115-23022004><FON=
T
face=3DArial color=3D#0000ff size=3D2>}</FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=3D910244015-23022004><SPAN class=3D986164115-23022004><FON=
T
face=3DArial color=3D#0000ff size=3D2></FONT></SPAN></SPAN> </DIV>
<DIV><SPAN class=3D910244015-23022004><SPAN class=3D986164115-23022004>
<DIV><FONT face=3DArial color=3D#800000 size=3D2>Donald C. Stephens</FONT><=
/DIV>
<DIV><FONT face=3DArial color=3D#800000 size=3D2>Associate Software
Engineer</FONT></DIV>
<DIV><FONT face=3DArial color=3D#800000 size=3D2>Analytics Prototyping and =
Scientific
Programming</FONT></DIV>
<DIV><FONT face=3DArial color=3D#800000 size=3D2>Moody's KMV</FONT></DIV>
<DIV><FONT face=3DArial color=3D#800000 size=3D2>Tel: 212.553.1346</F=
ONT></DIV>
<DIV><FONT face=3DArial color=3D#800000 size=3D2>Fax:
574.472.5990</FONT></DIV></SPAN></SPAN></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT face=3DTah=
oma
size=3D2>-----Original Message-----<BR><B>From:</B> cliff [at] globalmagic.com=
[mailto:cliff [at] globalmagic.com]<BR><B>Sent:</B> Monday, February 23, 2004=
9:52
AM<BR><B>To:</B> activeperl [at] listserv.ActiveState.com<BR><B>Subject:</B>=
counting differently<BR><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Is there a way to force a variable to wa=
lk
through the alphabet the way it can numbers?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>ie: for numbers: $k=3D0; $k=3D$k+1=
; would give
you 1</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>for letters $k=3D'a'; $k=3D$k+1; this wo=
n't give you
'b'; but is there any way of doing this that
will?</FONT></DIV></BLOCKQUOTE><CODE><FONT SIZE=3D3><BR>
<BR>
-----------<BR>
The information contained in this e-mail message, and any attachment, is co=
nfidential and for use solely by the intended recipient. If you have recei=
ved this message in error, please delete this message immediately. Althoug=
h Moody's KMV makes every effort to protect its computing environment from =
malicious code, Moody's KMV is not responsible for any virus or other type =
of suspect code that may be transferred via this e-mail message.<BR>
</FONT></CODE>
</BODY></HTML>
------_=_NextPart_001_01C3FA24.9041F7EB--
--===============1972395435==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1972395435==--
Re: counting differently
This is a multi-part message in MIME format.
--===============0677077318==
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0050_01C3F9FC.1B5F4890"
This is a multi-part message in MIME format.
------=_NextPart_000_0050_01C3F9FC.1B5F4890
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
to all who responded; THANKS! it worked!
----- Original Message -----
From: Bussink, Pim GJ SUKEP-EPE-T-D
To: cliff [at] globalmagic.com ; activeperl [at] listserv.ActiveState.com
Sent: Monday, February 23, 2004 10:44 AM
Subject: RE: counting differently
Cliff,
maybe as a Perl (but not programming) novice I am missing your point / =
application, but one could of course create an array [at] letter =3D (a..z) =
and walk through that, or if you are into Object Orientation create a =
letter class with a next() member function that knows the alphabet.
By the way, a question of mine: could one overload the ++ operator =
(which I like better than Cliff's '+ 1') instead of this next() above, =
by the way, such that
$letter =3D 'a';
$letter++ gives you 'b'? I guess you ned to hack the code for that? =
Far-fetched perhaps... Oh well.
Cheers, Pim
-----Original Message-----
From: cliff [at] globalmagic.com [mailto:cliff [at] globalmagic.com]
Sent: 23 February 2004 14:52
To: activeperl [at] listserv.ActiveState.com
Subject: counting differently
Is there a way to force a variable to walk through the alphabet the =
way it can numbers?
ie: for numbers: $k=3D0; $k=3D$k+1; would give you 1
for letters $k=3D'a'; $k=3D$k+1; this won't give you 'b'; but is =
there any way of doing this that will?
------=_NextPart_000_0050_01C3F9FC.1B5F4890
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>to all who responded; THANKS! it
worked!</FONT></DIV>
<BLOCKQUOTE dir=3Dltr
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>
<A title=3DPim.Bussink [at] Shell.com =
href=3D"mailto:Pim.Bussink [at] Shell.com">Bussink,
Pim GJ SUKEP-EPE-T-D</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3Dcliff [at] globalmagic.com
href=3D"mailto:cliff [at] globalmagic.com">cliff [at] globalmagic.com</A> ; <A
title=3Dactiveperl [at] listserv.ActiveState.com
=
href=3D"mailto:activeperl [at] listserv.ActiveState.com">activepe rl [at] listserv.A=
ctiveState.com</A>
</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Monday, February 23, 2004 =
10:44
AM</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Subject:</B> RE: counting =
differently</DIV>
<DIV><BR></DIV>
<DIV><FONT face=3DArial>
<DIV><SPAN class=3D263283715-23022004><FONT face=3DTahoma><FONT
color=3D#0000ff><FONT size=3D2><SPAN
=
class=3D421173915-23022004>Cliff,</SPAN></FONT></FONT></FONT></SPAN></DIV=
>
<DIV><SPAN class=3D263283715-23022004><FONT face=3DTahoma><FONT
color=3D#0000ff><FONT size=3D2><SPAN
=
class=3D421173915-23022004></SPAN></FONT></FONT></FONT></SPAN> </DIV=
>
<DIV><SPAN class=3D263283715-23022004><FONT size=3D+0><FONT =
size=3D+0><SPAN
class=3D421173915-23022004></SPAN><FONT face=3DTahoma><FONT =
color=3D#0000ff><FONT
size=3D2>maybe <SPAN class=3D421173915-23022004>as a Perl (but =
not
programming) novice </SPAN>I am missing your point / application,
but <SPAN class=3D421173915-23022004>one </SPAN>could of course =
create an
array [at] letter =3D (a..z) and walk through that, <SPAN
class=3D421173915-23022004>or if you are into Object Orientation
</SPAN>creat<SPAN class=3D421173915-23022004>e</SPAN> a <SPAN
class=3D421173915-23022004>letter class with a =
</SPAN>next() <SPAN
class=3D421173915-23022004>member </SPAN>function <SPAN
class=3D421173915-23022004>that knows the
alphabet.</SPAN></FONT></FONT></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D263283715-23022004><FONT size=3D+0><FONT =
size=3D+0><FONT
face=3DTahoma><FONT color=3D#0000ff><FONT size=3D2><SPAN
=
class=3D421173915-23022004></SPAN></FONT></FONT></FONT></FONT></FONT></SP=
AN> </DIV>
<DIV><SPAN class=3D263283715-23022004><FONT size=3D+0><FONT =
size=3D+0><FONT
face=3DTahoma><FONT color=3D#0000ff><FONT size=3D2><SPAN =
class=3D421173915-23022004>By
the way, a question of mine: could one overload the ++ operator =
(which I
like better than Cliff's '+ 1') instead of this next() above, by the =
way, such
that</SPAN></FONT></FONT></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D263283715-23022004><FONT size=3D+0><FONT =
size=3D+0><FONT
face=3DTahoma><FONT color=3D#0000ff><FONT size=3D2><SPAN
class=3D421173915-23022004>$letter =3D
'a';</SPAN></FONT></FONT></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D263283715-23022004><FONT size=3D+0><FONT =
size=3D+0><FONT
face=3DTahoma><FONT color=3D#0000ff><FONT size=3D2><SPAN
class=3D421173915-23022004>$letter++ gives you 'b'? I guess you =
ned to
hack the code for that? Far-fetched perhaps... Oh
well.</SPAN></FONT></FONT></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D263283715-23022004><FONT size=3D+0><FONT =
size=3D+0><FONT
face=3DTahoma><FONT color=3D#0000ff><FONT size=3D2><SPAN
=
class=3D421173915-23022004></SPAN></FONT></FONT></FONT></FONT></FONT></SP=
AN> </DIV>
<DIV><FONT face=3DTahoma><SPAN class=3D263283715-23022004><FONT =
face=3DArial
color=3D#0000ff size=3D2>Cheers, =
Pim</FONT></SPAN></FONT></DIV></FONT></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma
size=3D2>-----Original Message-----<BR><B>From:</B> =
cliff [at] globalmagic.com
[mailto:cliff [at] globalmagic.com]<BR><B>Sent:</B> 23 February 2004
14:52<BR><B>To:</B> =
activeperl [at] listserv.ActiveState.com<BR><B>Subject:</B>
counting differently<BR><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Is there a way to force a variable =
to walk
through the alphabet the way it can numbers?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>ie: for numbers: $k=3D0; =
$k=3D$k+1; would
give you 1</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>for letters $k=3D'a'; $k=3D$k+1; =
this won't give
you 'b'; but is there any way of doing this that
will?</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0050_01C3F9FC.1B5F4890--
--===============0677077318==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0677077318==--
RE: counting differently
This is a multi-part message in MIME format.
--===============0564689118==
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0095_01C3F9FB.D7475670"
This is a multi-part message in MIME format.
------=_NextPart_000_0095_01C3F9FB.D7475670
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: 7bit
Try reading documentation for function chr:
Perldoc -f chr
-----Original Message-----
From: activeperl-bounces [at] listserv.ActiveState.com
[mailto:activeperl-bounces [at] listserv.ActiveState.com] On Behalf Of
cliff [at] globalmagic.com
Sent: Monday, February 23, 2004 9:52 AM
To: activeperl [at] listserv.ActiveState.com
Subject: counting differently
Is there a way to force a variable to walk through the alphabet the way it
can numbers?
ie: for numbers: $k=0; $k=$k+1; would give you 1
for letters $k='a'; $k=$k+1; this won't give you 'b'; but is there any way
of doing this that will?
------=_NextPart_000_0095_01C3F9FB.D7475670
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)">
<style>
<!--
/* Font Definitions */
[at] font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EmailStyle17
{font-family:Arial;
color:navy;}
[at] page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body bgcolor=3Dwhite lang=3DEN-US link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Try reading documentation for =
function chr:</span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> =
Perldoc –f chr</span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DTahoma><span
style=3D'font-size:10.0pt;font-family:Tahoma'>-----Original =
Message-----<br>
<b><span style=3D'font-weight:bold'>From:</span></b>
activeperl-bounces [at] listserv.ActiveState.com
[mailto:activeperl-bounces [at] listserv.ActiveState.com] <b><span =
style=3D'font-weight:
bold'>On Behalf Of </span></b>cliff [at] globalmagic.com<br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Monday, February =
23, 2004
9:52 AM<br>
<b><span style=3D'font-weight:bold'>To:</span></b>
activeperl [at] listserv.ActiveState.com<br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> counting =
differently</span></font></p>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'> </span></font></p>
<div>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>Is there a way to force a =
variable
to walk through the alphabet the way it can numbers?</span></font></p>
</div>
<div>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>ie: for numbers: =
$k=3D0;
$k=3D$k+1; would give you 1</span></font></p>
</div>
<div>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>for letters $k=3D'a'; =
$k=3D$k+1; this
won't give you 'b'; but is there any way of doing this that =
will?</span></font></p>
</div>
</div>
</body>
</html>
------=_NextPart_000_0095_01C3F9FB.D7475670--
--===============0564689118==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0564689118==--
RE: counting differently
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--===============1210204036==
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C3FA2D.CB99F8E6"
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C3FA2D.CB99F8E6
Content-Type: text/plain
I meant to type:
"Use the prefix ++ operator:"
(It won't work as a postfix operator)
$ perl -e '$x = "z"; print $x++, "\n";'
z
-----Original Message-----
From: Anderson, Tony [mailto:Tony.Anderson [at] travelexamericas.com]
Sent: Monday, February 23, 2004 9:48 AM
To: activeperl [at] listserv.ActiveState.com
Subject: RE: counting differently
Use the prefix operator:
$ perl -e '$x = "a"; print ++$x, "\n";'
b
-----Original Message-----
From: cliff [at] globalmagic.com [mailto:cliff [at] globalmagic.com]
Sent: Monday, February 23, 2004 8:52 AM
To: activeperl [at] listserv.ActiveState.com
Subject: counting differently
Is there a way to force a variable to walk through the alphabet the way it
can numbers?
ie: for numbers: $k=0; $k=$k+1; would give you 1
for letters $k='a'; $k=$k+1; this won't give you 'b'; but is there any way
of doing this that will?
This electronic message contains information, which may be confidential,
privileged or otherwise protected from disclosure. The information is
intended to be used solely by the recipient(s) named. If you are not an
intended recipient, be aware that any review, disclosure, copying,
distribution or use of this message or its contents is prohibited. If you
have received this message in error, please notify the sender and delete
this message from your system. Employees of the company are prohibited from
making defamatory statements and from infringing copyright or any other
legal right. Any such communication or infringement is contrary to company
policy and outside the scope of employment.
This electronic message contains information, which may be confidential,
privileged or otherwise protected from disclosure. The information is
intended to be used solely by the recipient(s) named. If you are not an
intended recipient, be aware that any review, disclosure, copying,
distribution or use of this message or its contents is prohibited. If you
have received this message in error, please notify the sender and delete
this message from your system. Employees of the company are prohibited from
making defamatory statements and from infringing copyright or any other
legal right. Any such communication or infringement is contrary to company
policy and outside the scope of employment.
------_=_NextPart_001_01C3FA2D.CB99F8E6
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Message</TITLE>
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D736095116-23022004>I =
meant to
type:</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN
class=3D736095116-23022004></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D736095116-23022004><SPAN =
class=3D177214615-23022004><FONT face=3DArial size=3D2>"Use the prefix =
++
operator:"</FONT></SPAN></SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D736095116-23022004><SPAN =
class=3D177214615-23022004></SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D736095116-23022004><SPAN =
class=3D177214615-23022004>(It won't work as a postfix
operator)</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D736095116-23022004><SPAN =
class=3D177214615-23022004></SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D736095116-23022004><SPAN =
class=3D177214615-23022004>$ perl -e '$x =3D "z"; print $x++,
"\n";'<BR>z<BR></SPAN></SPAN></FONT></DIV>
<DIV></DIV>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr =
align=3Dleft><FONT face=3DTahoma
size=3D2>-----Original Message-----<BR><B>From:</B> Anderson, Tony
[mailto:Tony.Anderson [at] travelexamericas.com] <BR><B>Sent:</B> Monday, =
February
23, 2004 9:48 AM<BR><B>To:</B>
activeperl [at] listserv.ActiveState.com<BR><B>Subject:</B> RE: counting
differently<BR><BR></FONT></DIV>
<DIV><SPAN class=3D177214615-23022004><FONT face=3DArial size=3D2>Use =
the prefix
operator:</FONT></SPAN></DIV>
<DIV><SPAN class=3D177214615-23022004><FONT face=3DArial
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D177214615-23022004><FONT face=3DArial size=3D2>$ =
perl -e '$x =3D "a";
print ++$x, "\n";'<BR>b<BR></FONT></SPAN></DIV>
<DIV><SPAN class=3D177214615-23022004><FONT face=3DArial
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D177214615-23022004><FONT face=3DArial
size=3D2></FONT></SPAN> </DIV>
<DIV></DIV>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr =
align=3Dleft><FONT face=3DTahoma
size=3D2>-----Original Message-----<BR><B>From:</B> =
cliff [at] globalmagic.com
[mailto:cliff [at] globalmagic.com] <BR><B>Sent:</B> Monday, February 23, =
2004 8:52
AM<BR><B>To:</B> activeperl [at] listserv.ActiveState.com<BR><B>Subject:</B> =
counting
differently<BR><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Is there a way to force a variable to =
walk through
the alphabet the way it can numbers?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>ie: for numbers: $k=3D0; =
$k=3D$k+1; would give
you 1</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>for letters $k=3D'a'; $k=3D$k+1; this =
won't give you
'b'; but is there any way of doing this that will?</FONT></DIV><BR><BR>
<P><B><FONT face=3DArial size=3D2>This electronic message contains =
information,
which may be confidential, privileged or otherwise protected from =
disclosure.
The information is intended to be used solely by the recipient(s) =
named. If you
are not an intended recipient, be aware that any review, disclosure, =
copying,
distribution or use of this message or its contents is prohibited. If =
you have
received this message in error, please notify the sender and delete =
this message
from your system. Employees of the company are prohibited from making =
defamatory
statements and from infringing copyright or any other legal right. Any =
such
communication or infringement is contrary to company policy and outside =
the
scope of employment.</FONT></B></P><BR></BODY></HTML>
<BR>
<BR>
<P><B><FONT SIZE=3D2 FACE=3D"Arial">This electronic message contains =
information, which may be confidential, privileged or otherwise =
protected from disclosure. The information is intended to be used =
solely by the recipient(s) named. If you are not an intended =
recipient, be aware that any review, disclosure, copying, distribution =
or use of this message or its contents is prohibited. If you have =
received this message in error, please notify the sender and delete =
this message from your system. Employees of the company are prohibited =
from making defamatory statements and from infringing copyright or any =
other legal right. Any such communication or infringement is contrary =
to company policy and outside the scope of employment.</FONT></B></P>
<BR>
------_=_NextPart_001_01C3FA2D.CB99F8E6--
--===============1210204036==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1210204036==--
RE: counting differently
Anderson, Tony wrote:
>
> I meant to type:
>
> "Use the prefix ++ operator:"
>
> (It won't work as a postfix operator)
>
> $ perl -e '$x = "z"; print $x++, "\n";'
> z
No, it works fine. It is just the way you used it that doesn't "work".
perl -e "$x='z'; $x++; print $x"
aa
HTH
--
Brian Raven
------------------------------------------------------------ -----------
The information contained in this e-mail is confidential and solely
for the intended addressee(s). Unauthorised reproduction, disclosure,
modification, and/or distribution of this email may be unlawful. If you
have received this email in error, please notify the sender immediately
and delete it from your system. The views expressed in this message
do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary companies.
------------------------------------------------------------ -----------
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: counting differently
<cliff [at] globalmagic.com> wrote:
>
> Is there a way to force a variable to walk through the alphabet
> the way it can numbers?
No force required!
> ie: for numbers: $k=0; $k=$k+1; would give you 1
>
> for letters $k='a'; $k=$k+1; this won't give you 'b'; but is there
> any way of doing this that will?
Hi Cliff.
There's a lesson to be learned here: that Perl is smart enough to
do what you usually want.
$k = 'a'; $k = $k + 1;
evaluates to 1 because 'a' is first evaluated numerically as zero before adding 1. But
$k = 'a'; $k++;
leaves $k set to 'b'.
Look at the following code, which shows that you must never underestimate what Perl will
do for you.
HTH,
Rob
print for 'a' .. 'f';
print "\n";
my $c = 'm';
print $c++ until $c eq 'q';
print "\n";
print join ' ', 'w' .. 'ac';
print "\n";
print join ' ', 'a5' .. 'b2';
print "\n";
**OUTPUT
abcdef
mnop
w x y z aa ab ac
a5 a6 a7 a8 a9 b0 b1 b2
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: counting differently
very cool! thanks!
----- Original Message -----
From: "Rob Dixon" <rob [at] dixon.port995.com>
To: <cliff [at] globalmagic.com>; <activeperl [at] listserv.ActiveState.com>
Sent: Monday, February 23, 2004 1:03 PM
Subject: Re: counting differently
> <cliff [at] globalmagic.com> wrote:
> >
> > Is there a way to force a variable to walk through the alphabet
> > the way it can numbers?
>
> No force required!
>
> > ie: for numbers: $k=0; $k=$k+1; would give you 1
> >
> > for letters $k='a'; $k=$k+1; this won't give you 'b'; but is there
> > any way of doing this that will?
>
> Hi Cliff.
>
> There's a lesson to be learned here: that Perl is smart enough to
> do what you usually want.
>
> $k = 'a'; $k = $k + 1;
>
> evaluates to 1 because 'a' is first evaluated numerically as zero before
adding 1. But
>
> $k = 'a'; $k++;
>
> leaves $k set to 'b'.
>
> Look at the following code, which shows that you must never underestimate
what Perl will
> do for you.
>
> HTH,
>
> Rob
>
>
> print for 'a' .. 'f';
> print "\n";
>
> my $c = 'm';
> print $c++ until $c eq 'q';
> print "\n";
>
> print join ' ', 'w' .. 'ac';
> print "\n";
>
> print join ' ', 'a5' .. 'b2';
> print "\n";
>
> **OUTPUT
>
> abcdef
> mnop
> w x y z aa ab ac
> a5 a6 a7 a8 a9 b0 b1 b2
>
>
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Determine the OS
I need to determine the type of OS/Architecture that a script is running on.
Whether is linux 32, linux 64, Windows 32, Windwows 64, etc. Is there a clever
way in Perl to find this out without doing a system call?
Thank you,
Rolando
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Determine the OS
> I need to determine the type of OS/Architecture that a script is running on.
The question should be placed into FAQ :-)
If you need nothing extraordinary, use $^O variable:
perl -e"print $^O"
--
Andrew Shitov
____________________________________________________________ __________
andy [at] shitov.ru | http://www.shitov.ru
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Determine the OS
Rolando A Ampuero <> wrote:
> I need to determine the type of OS/Architecture that a script is
> running on. =
> =
> Whether is linux 32, linux 64, Windows 32, Windwows 64, etc. Is there
> a clever way in Perl to find this out without doing a system call? =
The special variable $^O will probably not be suitable for that level of
detail, so see 'perldoc Config'.
HTH
-- =
Brian Raven =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Atos Euronext Market Solutions Disclaimer
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =
Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.
L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.
Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Determine the OS
For windows, its quite a mess!
You can start by looking at 'Win32.pm' and the function
'Win32::GetOSVersion()'
But that will get you only so far.
You may want to look at how to get some of Windows internals by getting
'ScriptomaticV2.hta' from MS to see some internals.
Not sure of *NIX ways.
-----Original Message-----
From: activeperl-bounces [at] listserv.ActiveState.com
[mailto:activeperl-bounces [at] listserv.ActiveState.com] On Behalf Of Brian
Raven
Sent: Thursday, February 28, 2008 5:03 AM
To: activeperl [at] listserv.ActiveState.com
Subject: RE: Determine the OS
Rolando A Ampuero <> wrote:
> I need to determine the type of OS/Architecture that a script is =
> running on.
> =
> Whether is linux 32, linux 64, Windows 32, Windwows 64, etc. Is there =
> a clever way in Perl to find this out without doing a system call?
The special variable $^O will probably not be suitable for that level of
detail, so see 'perldoc Config'.
HTH
-- =
Brian Raven =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Atos Euronext Market Solutions Disclaimer
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
The information contained in this e-mail is confidential and solely for
the intended addressee(s). Unauthorised reproduction, disclosure,
modification, and/or distribution of this email may be unlawful. If you
have received this email in error, please notify the sender immediately
and delete it from your system. The views expressed in this message do
not necessarily reflect those of Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited - Registered in England & Wales
with registration no. 3962327. Registered office address at 25 Bank
Street London E14 5NQ United Kingdom. =
Atos Euronext Market Solutions SAS - Registered in France with
registration no. 425 100 294. Registered office address at 6/8
Boulevard Haussmann 75009 Paris France.
L'information contenue dans cet e-mail est confidentielle et uniquement
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est
adressee. Toute copie, publication ou diffusion de cet email est
interdite. Si cet e-mail vous parvient par erreur, nous vous prions de
bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail
et annexes jointes de votre systeme. Le contenu de ce message
electronique ne represente pas necessairement la position ou le point de
vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions
Limited Soci=E9t=E9 de droit anglais, enregistr=E9e au Royaume Uni sous le
num=E9ro 3962327, dont le si=E8ge social se situe 25 Bank Street E14 5NQ
Londres Royaume Uni.
Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e,
enregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro =
425
100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard
Haussmann 75009 Paris France. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Determine the OS
Stuart Arnold <mailto:stuart.arnold [at] comcast.net> wrote:
>> From: activeperl-bounces [at] listserv.ActiveState.com
>> [mailto:activeperl-bounces [at] listserv.ActiveState.com] On Behalf Of
>> Brian Raven =
>> Sent: Thursday, February 28, 2008 5:03 AM
>> To: activeperl [at] listserv.ActiveState.com
>> Subject: RE: Determine the OS
>> =
>> =
>> Rolando A Ampuero <> wrote:
>>> I need to determine the type of OS/Architecture that a script is
>>> running on. =
>>> =
>>> Whether is linux 32, linux 64, Windows 32, Windwows 64, etc. Is
there
>>> a clever way in Perl to find this out without doing a system call?
>> =
>> The special variable $^O will probably not be suitable for that level
>> of detail, so see 'perldoc Config'. =
>> =
>> HTH> For windows, its quite a mess!
> You can start by looking at 'Win32.pm' and the function
> 'Win32::GetOSVersion()' =
> But that will get you only so far.
> =
> You may want to look at how to get some of Windows internals by
> getting 'ScriptomaticV2.hta' from MS to see some internals. =
> =
> Not sure of *NIX ways.
Hmmm... my original post missed the point that the OP was interested in
the platform that the script was running on (I blame lack of caffeine).
The Config module is created at build time, so its information may not
be accurate at run time (e.g. you could have a 32 bit build running
under a 64 bit OS). Getting detailed information about the platform on
which a script is actually running is going to be platform specific, and
it is almost certainly going to involve system calls, or running
external commands (e.g. the uname command on *nix).
I suppose that the 'clever' answer would be avoid write scripts that
need to know that (see 'perldoc perlport' perhaps)!
HTH
-- =
Brian Raven =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Atos Euronext Market Solutions Disclaimer
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =
Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.
L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.
Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Determine the OS
On windows I usually use:
if (exists($ENV{PROCESSOR_ARCHITEW6432})) {
print "64 bit!\n";
}
Combine that with $^O to determine if you are on Unix or Windows and you ar=
e 75% there.
-----Original Message-----
From: activeperl-bounces [at] listserv.ActiveState.com [mailto:activeperl-bounce=
s [at] listserv.ActiveState.com] On Behalf Of Stuart Arnold
Sent: Thursday, February 28, 2008 5:33 AM
To: 'Brian Raven'; activeperl [at] listserv.ActiveState.com
Subject: RE: Determine the OS
For windows, its quite a mess!
You can start by looking at 'Win32.pm' and the function
'Win32::GetOSVersion()'
But that will get you only so far.
You may want to look at how to get some of Windows internals by getting
'ScriptomaticV2.hta' from MS to see some internals.
Not sure of *NIX ways.
-----Original Message-----
From: activeperl-bounces [at] listserv.ActiveState.com
[mailto:activeperl-bounces [at] listserv.ActiveState.com] On Behalf Of Brian
Raven
Sent: Thursday, February 28, 2008 5:03 AM
To: activeperl [at] listserv.ActiveState.com
Subject: RE: Determine the OS
Rolando A Ampuero <> wrote:
> I need to determine the type of OS/Architecture that a script is
> running on.
>
> Whether is linux 32, linux 64, Windows 32, Windwows 64, etc. Is there
> a clever way in Perl to find this out without doing a system call?
The special variable $^O will probably not be suitable for that level of
detail, so see 'perldoc Config'.
HTH
--
Brian Raven
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Atos Euronext Market Solutions Disclaimer
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
The information contained in this e-mail is confidential and solely for
the intended addressee(s). Unauthorised reproduction, disclosure,
modification, and/or distribution of this email may be unlawful. If you
have received this email in error, please notify the sender immediately
and delete it from your system. The views expressed in this message do
not necessarily reflect those of Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited - Registered in England & Wales
with registration no. 3962327. Registered office address at 25 Bank
Street London E14 5NQ United Kingdom.
Atos Euronext Market Solutions SAS - Registered in France with
registration no. 425 100 294. Registered office address at 6/8
Boulevard Haussmann 75009 Paris France.
L'information contenue dans cet e-mail est confidentielle et uniquement
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est
adressee. Toute copie, publication ou diffusion de cet email est
interdite. Si cet e-mail vous parvient par erreur, nous vous prions de
bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail
et annexes jointes de votre systeme. Le contenu de ce message
electronique ne represente pas necessairement la position ou le point de
vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions
Limited Soci=E9t=E9 de droit anglais, enregistr=E9e au Royaume Uni sous le
num=E9ro 3962327, dont le si=E8ge social se situe 25 Bank Street E14 5NQ
Londres Royaume Uni.
Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e,
enregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro =
425
100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard
Haussmann 75009 Paris France. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Determine the OS
Correction - that's only if you are in a 32bit shell on a 64bit system. It=
would probably be more appropriate to check PROCESSOR_ARCHITECTURE to see =
if its x86 or not.
http://msdn.microsoft.com/library/default.asp?url=3D/library /en-us/win64/wi=
n64/wow64_implementation_details.asp
-----Original Message-----
From: activeperl-bounces [at] listserv.ActiveState.com [mailto:activeperl-bounce=
s [at] listserv.ActiveState.com] On Behalf Of Joel Friedman
Sent: Thursday, February 28, 2008 3:07 PM
To: 'stuart.arnold [at] comcast.net'; 'Brian Raven'; activeperl [at] listserv.ActiveS=
tate.com
Subject: RE: Determine the OS
On windows I usually use:
if (exists($ENV{PROCESSOR_ARCHITEW6432})) {
print "64 bit!\n";
}
Combine that with $^O to determine if you are on Unix or Windows and you ar=
e 75% there.
-----Original Message-----
From: activeperl-bounces [at] listserv.ActiveState.com [mailto:activeperl-bounce=
s [at] listserv.ActiveState.com] On Behalf Of Stuart Arnold
Sent: Thursday, February 28, 2008 5:33 AM
To: 'Brian Raven'; activeperl [at] listserv.ActiveState.com
Subject: RE: Determine the OS
For windows, its quite a mess!
You can start by looking at 'Win32.pm' and the function
'Win32::GetOSVersion()'
But that will get you only so far.
You may want to look at how to get some of Windows internals by getting
'ScriptomaticV2.hta' from MS to see some internals.
Not sure of *NIX ways.
-----Original Message-----
From: activeperl-bounces [at] listserv.ActiveState.com
[mailto:activeperl-bounces [at] listserv.ActiveState.com] On Behalf Of Brian
Raven
Sent: Thursday, February 28, 2008 5:03 AM
To: activeperl [at] listserv.ActiveState.com
Subject: RE: Determine the OS
Rolando A Ampuero <> wrote:
> I need to determine the type of OS/Architecture that a script is
> running on.
>
> Whether is linux 32, linux 64, Windows 32, Windwows 64, etc. Is there
> a clever way in Perl to find this out without doing a system call?
The special variable $^O will probably not be suitable for that level of
detail, so see 'perldoc Config'.
HTH
--
Brian Raven
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Atos Euronext Market Solutions Disclaimer
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
The information contained in this e-mail is confidential and solely for
the intended addressee(s). Unauthorised reproduction, disclosure,
modification, and/or distribution of this email may be unlawful. If you
have received this email in error, please notify the sender immediately
and delete it from your system. The views expressed in this message do
not necessarily reflect those of Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited - Registered in England & Wales
with registration no. 3962327. Registered office address at 25 Bank
Street London E14 5NQ United Kingdom.
Atos Euronext Market Solutions SAS - Registered in France with
registration no. 425 100 294. Registered office address at 6/8
Boulevard Haussmann 75009 Paris France.
L'information contenue dans cet e-mail est confidentielle et uniquement
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est
adressee. Toute copie, publication ou diffusion de cet email est
interdite. Si cet e-mail vous parvient par erreur, nous vous prions de
bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail
et annexes jointes de votre systeme. Le contenu de ce message
electronique ne represente pas necessairement la position ou le point de
vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions
Limited Soci=E9t=E9 de droit anglais, enregistr=E9e au Royaume Uni sous le
num=E9ro 3962327, dont le si=E8ge social se situe 25 Bank Street E14 5NQ
Londres Royaume Uni.
Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e,
enregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro =
425
100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard
Haussmann 75009 Paris France. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs