[31425] in Perl-Users-Digest
Perl-Users Digest, Issue: 2677 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 15 14:09:38 2009
Date: Sun, 15 Nov 2009 11:09:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 15 Nov 2009 Volume: 11 Number: 2677
Today's topics:
Re: How to identify double bytes language? <hjp-usenet2@hjp.at>
Re: mingw Perl: no long doubles? <bart.lateur@pandora.be>
Re: mingw Perl: no long doubles? <nospam-abuse@ilyaz.org>
Re: mingw Perl: no long doubles? <sisyphus359@gmail.com>
Re: mingw Perl: no long doubles? <hjp-usenet2@hjp.at>
Re: mingw Perl: no long doubles? (Seymour J.)
Re: Please help with processing flat file <nobody@nowhere.com>
Re: Please help with processing flat file <tadmc@seesig.invalid>
Re: Please help with processing flat file <tadmc@seesig.invalid>
Weird unequality compare questions? <r.mariotti@fdcx.net>
Re: Weird unequality compare questions? <sbryce@scottbryce.com>
Re: Weird unequality compare questions? <sbryce@scottbryce.com>
Re: Weird unequality compare questions? <r.mariotti@fdcx.net>
Re: Weird unequality compare questions? <hjp-usenet2@hjp.at>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 15 Nov 2009 00:46:55 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: How to identify double bytes language?
Message-Id: <slrnhfugbg.9m.hjp-usenet2@hrunkner.hjp.at>
On 2009-11-14 10:03, Peter J. Holzer <hjp-usenet2@hjp.at> wrote:
> But in general I would convert the whole text to Unicode and check the
> character properties. This works for *all* encodings, no matter how
> complicated they are:
[...]
> for my $class (qw(Han Latin)) {
> if ($char =~ /\p{$class}/) {
Forgot to add: The full list of properties can be found in
perldoc perlunicode.
hp
------------------------------
Date: Sun, 15 Nov 2009 01:27:21 +0100
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: mingw Perl: no long doubles?
Message-Id: <nbiuf5pjl8so6u6tgn425de5vsnrr7lq7r@4ax.com>
Ilya Zakharevich wrote:
>Inspecting robot reports on module testing (e.g.,
> http://www.nntp.perl.org/group/perl.cpan.testers/2009/11/msg5955376.html
>), I see that the version of compiler used for some MSWin32 builds do
>not have "honest" long doubles: I see: longdblsize=8.
>
>Can somebody explain the reasoning for such an omission? Or is it a
>bug in Configure-stage of Perl build?
Maybe the C compiler is just not capable of real "long doubles"?
Wikipedia says the following about "long double":
http://en.wikipedia.org/wiki/Long_double
In C and related programming languages, long double refers to a
floating point data type that is *often* more precise than
double precision.
On the x86 architecture, most compilers implement long double as
the 80-bit extended precision type supported by that hardware
(sometimes stored as 12 or 16 bytes to maintain data structure
alignment). An exception is Microsoft Visual C++ for x86, which
makes long double a synonym for double.
(emphasis mine)
Microsoft claims that this is not a mistake:
http://msdn.microsoft.com/en-us/library/9cx8xs15.aspx
Long Double
Previous 16-bit versions of Microsoft C/C++ and Microsoft Visual
C++ supported the long double, 80-bit precision data type. In
Win32 programming, however, the long double data type maps to
the double, 64-bit precision data type. The Microsoft run-time
library provides long double versions of the math functions only
for backward compatibility. The long double function prototypes
are identical to the prototypes for their double counterparts,
except that the long double data type replaces the double data
type. The long double versions of these functions should not be
used in new code.
So, in theory, the compiler should support it, but Microsoft recommends
against it.
--
Bart.
------------------------------
Date: Sun, 15 Nov 2009 05:46:09 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: mingw Perl: no long doubles?
Message-Id: <slrnhfv5d1.3ai.nospam-abuse@powdermilk.math.berkeley.edu>
On 2009-11-15, Bart Lateur <bart.lateur@pandora.be> wrote:
> Wikipedia says the following about "long double":
> alignment). An exception is Microsoft Visual C++ for x86, which
> makes long double a synonym for double.
> Microsoft claims that this is not a mistake:
> http://msdn.microsoft.com/en-us/library/9cx8xs15.aspx
>
> Long Double
>
> Previous 16-bit versions of Microsoft C/C++ and Microsoft Visual
> C++ supported the long double, 80-bit precision data type. In
> Win32 programming, however, the long double data type maps to
> the double, 64-bit precision data type. The Microsoft run-time
> library provides long double versions of the math functions only
> for backward compatibility. The long double function prototypes
> are identical to the prototypes for their double counterparts,
> except that the long double data type replaces the double data
> type. The long double versions of these functions should not be
> used in new code.
>
> So, in theory, the compiler should support it, but Microsoft recommends
> against it.
Thanks, very enlightening.
I think I can even guess the rationales. Given the crippled alpha
architecture, and the M$'s desire to support Windows-on-alpha, they
want everybody to downgrade to the lowest common denominator...
Or do I miss anything else?
Yours,
Ilya
------------------------------
Date: Sun, 15 Nov 2009 00:09:01 -0800 (PST)
From: sisyphus <sisyphus359@gmail.com>
Subject: Re: mingw Perl: no long doubles?
Message-Id: <01801f38-70c0-4fa2-bde9-224f8eea11aa@a37g2000prf.googlegroups.com>
On Nov 13, 5:53=A0pm, Ilya Zakharevich <nospam-ab...@ilyaz.org> wrote:
> Inspecting robot reports on module testing (e.g.,
> =A0http://www.nntp.perl.org/group/perl.cpan.testers/2009/11/msg5955376.ht=
ml
> ), I see that the version of compiler used for some MSWin32 builds do
> not have "honest" long doubles: I see: longdblsize=3D8.
>
> Can somebody explain the reasoning for such an omission? =A0Or is it a
> bug in Configure-stage of Perl build?
MinGW certainly has (12 byte) long doubles but I don't know of anyone
having built a mingw perl that has long double support.
To achieve long double support with a mingw-built perl, I would think
it's just a matter of creating an appropriate version of win32/
config.gc ... but then, given that mingw uses the msvcrt.dll runtime,
I envisage there might be some hoops to jump through in order to get
these 'long double' values to print() correctly.
Cheers,
Rob
------------------------------
Date: Sun, 15 Nov 2009 14:12:35 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: mingw Perl: no long doubles?
Message-Id: <slrnhfvvi3.1fg.hjp-usenet2@hrunkner.hjp.at>
On 2009-11-13 06:53, Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> Inspecting robot reports on module testing (e.g.,
> http://www.nntp.perl.org/group/perl.cpan.testers/2009/11/msg5955376.html
> ), I see that the version of compiler used for some MSWin32 builds do
> not have "honest" long doubles: I see: longdblsize=8.
>
> Can somebody explain the reasoning for such an omission? Or is it a
> bug in Configure-stage of Perl build?
>
> P.S. Due to a bug in test suite, today it has come to my attension
> that similar restrictions exist on s390 and alpha linuxes; but
> there it is hardware limitation; while Win32 in question is
> ix86...
Wrong. The Alpha architecture does have a 128 bit floating point type
(in fact it has two of them: The VAX-compatible H_floating and the alpha
specific (and supposedly IEEE-754 compatible) X_floating type). It's
possible that some compilers don't support it, of course.
hp
------------------------------
Date: Sat, 14 Nov 2009 17:56:01 -0500
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: mingw Perl: no long doubles?
Message-Id: <4aff3581$2$fuzhry+tra$mr2ice@news.patriot.net>
In <slrnhfq0jr.lgf.nospam-abuse@powdermilk.math.berkeley.edu>, on
11/13/2009
at 06:53 AM, Ilya Zakharevich <nospam-abuse@ilyaz.org> said:
>P.S. Due to a bug in test suite, today it has come to my attension
> that similar restrictions exist on s390 and alpha linuxes; but
> there it is hardware limitation;
Does "s390" refer only to IBM's old S/390 line or also to the current
zSeries line? Certainly all current zSeries processors have 64-bit
arithmetic, and I believe that the earliest ones did as well.
--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>
Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to spamtrap@library.lspace.org
------------------------------
Date: Sat, 14 Nov 2009 23:17:28 GMT
From: nobody <nobody@nowhere.com>
Subject: Re: Please help with processing flat file
Message-Id: <cUGLm.195254$Ca6.42328@en-nntp-03.dc1.easynews.com>
On Sat, 14 Nov 2009 23:04:44 +0000, Doug Miller wrote:
> In article <poCLm.191369$Ca6.97784@en-nntp-03.dc1.easynews.com>, nobody
> <nobody@nowhere.com> wrote:
>
>>Hey dude, you're confused. I'm working with various data files in
>>various formats. Some are flat files, some are delimited. You should
>>learn some manners, give up your lame attempts at humor, And learn how
>>to spell genera.
>
> You, too. It's "genre". "Genera" is something different.
I know that only too well, and stand corrected!
------------------------------
Date: Sat, 14 Nov 2009 19:08:19 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Please help with processing flat file
Message-Id: <slrnhfukuq.uo7.tadmc@tadbox.sbcglobal.net>
nobody <nobody@nowhere.com> wrote:
^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^
[ I would suggest choosing a less-generic posting address.
I have had that one killfiled for several years.
That is, your posts are being scored way down because of what
somebody else did while using that address...
]
> On Fri, 13 Nov 2009 20:37:20 -0600, Tad McClellan wrote:
>
> Thanks for your answer, it does exactly as I asked.
You're welcome.
> However, the data
> files I'm dealing with are more complicated.
If you change the question, the answer is likely to change.
So you should ask the real question right up front.
> Any help would be greatly
> appreciated again!
Sorry, you have already used up all of your coupons.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Sat, 14 Nov 2009 19:14:30 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Please help with processing flat file
Message-Id: <slrnhfulac.uo7.tadmc@tadbox.sbcglobal.net>
James Egan <jegan473@comcast.net> wrote:
> On Fri, 13 Nov 2009 20:37:20 -0600, Tad McClellan wrote:
>
>> nobody <nobody@nowhere.com> wrote:
>>> I'm trying to process flat files with many thousands of records. In
>>> these files several rows comprise the information for a single
>>> customer. In the example __DATA__ below, I'm trying to fill the
>>> variables with the customer information while the customer number is
>>> 06020004293, then for customer number 07020000279, and finally customer
>>> number 09020000251.
>
>
> I answered my own question.
No you didn't.
> See the block below:
>
> elsif ( $code eq 'B' ) {
> $buffer{Daughter2} = substr $_, 14, 17;
>
> if (!defined $buffer{Daughter}) {
> $buffer{Daughter} = substr $_, 14, 17;
> }
That answers nobody@nowhere.com's question.
You are not nobody@nowhere.com, you are jegan473@comcast.net...
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Sat, 14 Nov 2009 21:07:40 -0500
From: bobmct <r.mariotti@fdcx.net>
Subject: Weird unequality compare questions?
Message-Id: <l0ouf5tnadgbs0llkjsti07l7f5fdmv6k8@4ax.com>
I know my eyesight is getting bad but I'm pounding my head with this
rather simple unequal compare.
I have a text file, the starting portion of which appears below. The
fir field is a filename followed by a tab and the second field is a
full path
I simply wish to print the filename if/when it changes from the
previous record processed.
I've also printed some fields and logic results for debugging
purposes. The output of the debugging also appears below and of
course my code loop is there as well.
Can some of you please look at my unequal compare statement to help me
determine why it is NOT detecting a difference in MOST of the records?
Thanks
input file snippet
-------------------
- dsl line only service agreement 1.15.02.pdf C:\Documents and
Settings\bobm3\My Documents\My Files\pdf\
-Release Notes-.rtf C:\Documents and Settings\bobm3\My
Documents\My PaperPort Documents\Samples\
4622XL.cfg C:\Documents and Settings\bobm3\My
Documents\Source\netopia\
!finallo.bmp C:\Documents and Settings\bobm3\My Documents\My
Files\fdcx1\usr\
!finallo.bmp C:\Documents and Settings\bobm3\My Documents\My
Files\fdcx1\usr\
!finallo.jpe C:\Documents and Settings\bobm3\My Documents\My
Files\fdcx1\usr\
!finallo.jpe C:\Documents and Settings\bobm3\My Documents\My
Files\fdcx1\usr\
# 001 bronze training form.wpd C:\Documents and Settings\bobm3\My
Documents\My Files\training contract unit lists\
# 001 gold training form.wpd C:\Documents and Settings\bobm3\My
Documents\My Files\training contract unit lists\
code snippet
---------------
# Process Sequence File Listing File
while (<IFH>) {
chomp;
($filename, $path) = split /\t/;
print "filename=[$filename],priorfilename=[$priorfilename]\n";
# Determine if filename should print
if ("$filename" != "$priorfilename") {
print "printing filename\n";
$priorfilename = $filename;
$~ = "OFH_Filename";
write(OFH);
} else {
print "NOT printing\n";
}
# Now output path info
$~ = "OFH_Detail";
write(OFH);
}
debugging output snippet
------------------------------
filename=[- dsl line only service agreement
1.15.02.pdf],priorfilename=[]
NOT printing
filename=[-Release Notes-.rtf],priorfilename=[]
NOT printing
filename=[ 4622XL.cfg],priorfilename=[]
printing filename
filename=[!finallo.bmp],priorfilename=[ 4622XL.cfg]
printing filename
filename=[!finallo.bmp],priorfilename=[!finallo.bmp]
NOT printing
filename=[!finallo.jpe],priorfilename=[!finallo.bmp]
NOT printing
filename=[!finallo.jpe],priorfilename=[!finallo.bmp]
NOT printing
filename=[# 001 bronze training form.wpd],priorfilename=[!finallo.bmp]
NOT printing
------------------------------
Date: Sat, 14 Nov 2009 19:24:46 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: Weird unequality compare questions?
Message-Id: <hdnoqs$fti$1@news.eternal-september.org>
bobmct wrote:
> # Process Sequence File Listing File
> while (<IFH>) {
> chomp;
> ($filename, $path) = split /\t/;
> print "filename=[$filename],priorfilename=[$priorfilename]\n";
> # Determine if filename should print
> if ("$filename" != "$priorfilename") {
if ("$filename" ne "$priorfilename") {
!= compares numbers. ne compares strings.
------------------------------
Date: Sat, 14 Nov 2009 19:26:59 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: Weird unequality compare questions?
Message-Id: <hdnov1$fti$2@news.eternal-september.org>
Scott Bryce wrote:
> bobmct wrote:
>> # Process Sequence File Listing File
>> while (<IFH>) {
>> chomp;
>> ($filename, $path) = split /\t/;
>> print "filename=[$filename],priorfilename=[$priorfilename]\n";
>> # Determine if filename should print
>> if ("$filename" != "$priorfilename") {
>
> if ("$filename" ne "$priorfilename") {
Someone will probably point out that the strings don't need to be quoted.
if ($filename ne $priorfilename) {
------------------------------
Date: Sun, 15 Nov 2009 08:12:31 -0500
From: bobmct <r.mariotti@fdcx.net>
Subject: Re: Weird unequality compare questions?
Message-Id: <5fvvf5hvbe7or84gl63kdk23hnjj58ssoc@4ax.com>
On Sat, 14 Nov 2009 19:24:46 -0700, Scott Bryce
<sbryce@scottbryce.com> wrote:
>bobmct wrote:
>> # Process Sequence File Listing File
>> while (<IFH>) {
>> chomp;
>> ($filename, $path) = split /\t/;
>> print "filename=[$filename],priorfilename=[$priorfilename]\n";
>> # Determine if filename should print
>> if ("$filename" != "$priorfilename") {
>
> if ("$filename" ne "$priorfilename") {
>
>
>!= compares numbers. ne compares strings.
Duh! I should have caught that. Thanks for your quick response.
B
------------------------------
Date: Sun, 15 Nov 2009 14:16:15 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Weird unequality compare questions?
Message-Id: <slrnhfvvov.1fg.hjp-usenet2@hrunkner.hjp.at>
On 2009-11-15 02:26, Scott Bryce <sbryce@scottbryce.com> wrote:
> Scott Bryce wrote:
>> bobmct wrote:
>>> if ("$filename" != "$priorfilename") {
>>
>> if ("$filename" ne "$priorfilename") {
>
> Someone will probably point out that the strings don't need to be quoted.
>
> if ($filename ne $priorfilename) {
And someone else will point out that
use warnings;
use strict;
at the beginning of each script is always a good idea.
hp
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 2677
***************************************