[31413] in Perl-Users-Digest
Perl-Users Digest, Issue: 2665 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 4 21:09:44 2009
Date: Wed, 4 Nov 2009 18:09:10 -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 Wed, 4 Nov 2009 Volume: 11 Number: 2665
Today's topics:
Re: "un-meta" the control characters <derykus@gmail.com>
Re: Anything to be done about utf8 regexp performance? <whynot@pozharski.name>
Re: FAQ 6.12 Can I use Perl regular expressions to matc sln@netherlands.com
Re: FAQ 6.12 Can I use Perl regular expressions to matc <nospam-abuse@ilyaz.org>
Re: How to process duplicate entries in tab separated f <cartercc@gmail.com>
Re: How to process duplicate entries in tab separated f <tadmc@seesig.invalid>
Re: How to process duplicate entries in tab separated f <jegan473@comcast.net>
Re: How to process duplicate entries in tab separated f <someone@example.com>
Re: How to process duplicate entries in tab separated f sharma__r@hotmail.com
Re: How to process duplicate entries in tab separated f sln@netherlands.com
Re: How to process duplicate entries in tab separated f <jegan473@comcast.net>
Re: How to process duplicate entries in tab separated f <jegan473@comcast.net>
Re: How to process duplicate entries in tab separated f <jimsgibson@gmail.com>
Re: How to process duplicate entries in tab separated f <ben@morrow.me.uk>
Re: How to process duplicate entries in tab separated f sln@netherlands.com
Re: unintialised warning <justin.0908@purestblue.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 3 Nov 2009 20:00:53 -0800 (PST)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: "un-meta" the control characters
Message-Id: <effeb05f-ac08-4e3d-ba03-8c7b873d5bb7@a39g2000pre.googlegroups.com>
On Nov 3, 11:18=A0am, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth "C.DeRykus" <dery...@gmail.com>:
>
>
>
> > On Nov 2, 11:07=A0am, Paul Lalli <mri...@gmail.com> wrote:
>
> > > for (qw/n t f r v/) {
> > > =A0 =A0my $meta =3D eval("\\$_");
> > > =A0 =A0$string =3D~ s/$meta/\\$_/;
>
> > > }
>
> > Did that work? I don't understand why the eval is needed
> > at all:
>
> > my $string =3D "1\n 2\t 3\f 4\r 5\cK";
> > for (qw/n t f r cK/) {
> > =A0 =A0 my $meta =3D "\\$_";
> > =A0 =A0 $string =3D~ s/$meta/\\$_/;
> > }
> > print $string; =A0 # =A01\n 2\t 3\f =A04\r =A05\cK
>
> That's... evil. It relies on the fact that regexes undergo two separate
> expansion phases, and requires that variable expansion happens in the
> first phase but other qqish escapes are expanded in the second. I'm not
> entirely convinced that's documented behaviour: anyone care to dig out
> perlre and prove it one way or the other?
>
> For extra added evil:
>
> =A0 =A0 my $bs =3D "\\";
> =A0 =A0 $string =3D~ s/$bs$_/$bs$_/g for qw/n r t f/;
>
Perl magic is evil? Say it ain't so :)
I didn't spot a full explanation in perlre but I see perlop
steps through the compilation in "gory details of parsing
quoted constructs" and ends with what happens at runtime
in "parsing regular expressions".
This closely mirrors Chapter 7's section - Perl Regular
Expressions in J.Friedl's "Mastering Regular Expressions"
1st ed.
--
Charles DeRykus
------------------------------
Date: Wed, 04 Nov 2009 09:43:33 +0200
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: Anything to be done about utf8 regexp performance?
Message-Id: <slrnhf2c55.rsi.whynot@orphan.zombinet>
On 2009-11-03, Jochen Lehmeier <OJZGSRPBZVCX@spammotel.com> wrote:
*SKIP*
> #!/usr/local/bin/perl
>
> use strict;
> use warnings;
>
> my $a = "a".("x" x 1000);
> my $b = "\x{1234}".("x" x 1000);
>
> for (0..1000)
> {
> $a =~ s/r/xxx/;
> $a =~ s/r/xxx/i;
> $b =~ s/r/xxx/;
> $b =~ s/r/xxx/i;
> }
>
*SKIP*
> I can live with line 13, but line 14 is not funny anymore. 344 times
> slower than a latin1 regexp... or 161 times slower than a
> latin1-case-insentitive one.
>
> I understand that case calculations are much more complex in utf8 than
> latin1. Is there anything that can be done, anyway?
HTH (as you can see, that idea has it's limitations):
#!/usr/bin/perl
use strict;
use warnings;
use Benchmark qw{ cmpthese timethese };
my $a = "a" . ("x" x 1000);
my $b = "\x{1234}" . ("x" x 1000);
cmpthese timethese -3, {
code00 => sub { $a =~ s/r/xxx/i; },
code01 => sub { $b =~ s/r/xxx/i; },
code02 => sub { $b =~ s/[rR]/xxx/; },
};
__END__
Benchmark: running code00, code01, code02 for at least 3 CPU seconds...
code00: 2 wallclock secs ( 3.02 usr + 0.00 sys = 3.02 CPU) @ 316342.72/s (n=955355)
code01: 4 wallclock secs ( 3.20 usr + 0.00 sys = 3.20 CPU) @ 4509.38/s (n=14430)
code02: 2 wallclock secs ( 3.13 usr + 0.00 sys = 3.13 CPU) @ 57964.86/s (n=181430)
Rate code01 code02 code00
code01 4509/s -- -92% -99%
code02 57965/s 1185% -- -82%
code00 316343/s 6915% 446% --
--
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom
------------------------------
Date: Tue, 03 Nov 2009 18:12:15 -0800
From: sln@netherlands.com
Subject: Re: FAQ 6.12 Can I use Perl regular expressions to match balanced text?
Message-Id: <7hn1f51v6sndv628tfd30jig6u20m6qh1j@4ax.com>
On Tue, 3 Nov 2009 07:58:09 +0000, Ben Morrow <ben@morrow.me.uk> wrote:
>
>Quoth sln@netherlands.com:
>> On Sun, 01 Nov 2009 15:15:15 -0600, brian d foy <brian.d.foy@gmail.com> wrote:
>>
>> >I don't get a crash, just an error which is entirely appriopriate:
>> >
>> >Reference to nonexistent group in regex; marked by <-- HERE in m/(?:
>> > [^<>]*+ # one or more non angle brackets, non backtracking
>> > |
>> > (?1) <-- HERE # found < or >, so recurse to capture
>> >buffer 1
>> > )*/ at test.pl line 12.
>>
>> Maybe you should try and run all the code instead of just a code
>> segment.
>>
>> Try running this:
><snip>
>>
>> my @enter; # position queue of each nested level of bracket
>>
>> my $regex = qr/
>>
>> (
>> < # open angle bracket
>> (?{ push @enter,pos();
>
>Using lexicals in (?{}) assertions is known to sometimes cause crashes
>and other weird behaviour (this is indeed a bug, but a known one that is
>difficult to fix: those assertions are documented as experimental for a
>reason, despite being in widespread use). Do you still see the crash if
>you remove the code assertions? If you replace the 'my $enter' with 'our
>$enter'?
>
>Ben
Actually its a little more insidious, but it is in the assertion.
This:
(?{ print "\n* leave ",scalar(@enter),"> at ",pos()," = Found: ";
print substr($_, $enter[$#enter]-1, 1+pos() - pop @enter);
})
notably, the substr(), was given $#enter, pop() of an empty array
(-1 and undef respectively). While this doesent crash outside a regex (gives
a runtime warning), it does within the assertion. Because its eval'd?
There shouldn't have been an empty array when pop'd, but thats another
story with the behavior of recursion. I've figured out how to use it
effectively/efficiently. I'm going to post the results. This regex form as
listed in this faq example is laborious. There is exponentially duplicate
recursion depending on the amount un-balanced opening's (nesting).
But there is a fix.
-sln
------------------------------
Date: Wed, 4 Nov 2009 06:50:31 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: FAQ 6.12 Can I use Perl regular expressions to match balanced text?
Message-Id: <slrnhf291n.hnn.nospam-abuse@powdermilk.math.berkeley.edu>
On 2009-11-04, Ben Morrow <ben@morrow.me.uk> wrote:
>
> Quoth Ilya Zakharevich <nospam-abuse@ilyaz.org>:
>> On 2009-11-03, Ben Morrow <ben@morrow.me.uk> wrote:
>> > Using lexicals in (?{}) assertions is known to sometimes cause crashes
>> > and other weird behaviour (this is indeed a bug, but a known one that is
>> > difficult to fix
>>
>> I think they are very easy to fix... (At the time I created this
>> feature, I have not yet fully understood how closures are implemented,
>> so missed one case.)
>
> Then please post a patch to p5p demonstrating the fix, since everyone
> there seems to think it's rather tricky.
I'm sitting on (probably) a hundred of patches to Perl. Most
disappear without trace...
Hope this helps,
Ilya
------------------------------
Date: Tue, 3 Nov 2009 18:09:38 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: How to process duplicate entries in tab separated file?
Message-Id: <90cdc006-03f9-44a6-b569-0c8eb412ac9c@s31g2000yqs.googlegroups.com>
On Nov 3, 7:08=A0pm, James Egan <jegan...@comcast.net> wrote:
> What I'm trying to do is IF there are duplicate customer numbers, then
> print them consecutively. =A0So the __DATA__ below printed out would look
> like this, with duplicate customers printed together, and unique
> customers printed as they are like:
Then each hash key would contain a reference to an anonymous array.
You still get the keys as unique IDs, but the value, instead of being
a scalar, would be a reference to an anonymous array, which you would
push like this:
push @{$customers{$key}}, "data";
You would print them like this:
foreach my $key (sort keys %customers)
{
#print each unique identifier
print "$key\n";
#then print the values for that key
foreach my $ele (@{$customers{$key}})
{
print " -- $ele\n";
}
}
This really isn't difficult, but simply a data management problem. An
author named Cross (last name) wrote a book about ten years ago about
munging data with Perl. It's an old book, but cheap now, and worth the
$5.00 (or so) you will pay on half.com or amazon.com, and will
certainly introduce you to some techniques of doing stuff like this.
CC.
------------------------------
Date: Tue, 03 Nov 2009 21:29:15 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: How to process duplicate entries in tab separated file?
Message-Id: <slrnhf1t59.5ko.tadmc@tadbox.sbcglobal.net>
James Egan <jegan473@comcast.net> wrote:
> use vars qw(
use vars is still an anachronism...
and global variables are still bad...
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Wed, 04 Nov 2009 03:52:27 GMT
From: James Egan <jegan473@comcast.net>
Subject: Re: How to process duplicate entries in tab separated file?
Message-Id: <%T6Im.150298$ua.72136@en-nntp-05.dc1.easynews.com>
On Wed, 04 Nov 2009 00:28:45 +0000, Ben Morrow wrote:
Here's some of the things I've tried suggested in this group:
#!/usr/bin/perl
use strict;
use warnings;
use vars qw(
@file
@fields
$fields
$line
$ctr
$custno
@customers
$customers
%customer
%customers
$key
);
while (<DATA>) {
chomp;
my ($id, $fn, $ln, $addy) = split;
$customers{$id} = "$fn, $ln, $addy" unless $customers{$key};
print "$id is duplicate: $fn $ln, $addy\n" if $customers{$id};
}
#local $\ = qq{\n};
#my %h;
#while (<DATA>) {
# chomp; next unless /\S/;
# my $custno = (split)[0];
# print $custno if exists $h{$custno};
# $h{$custno}++;
#}
__DATA__
07020000279 Joe Smith 54 Abbey Road
05020033486 John Jones 98 New York Ave.
07020000279 George Washington 234 Washington Ave.
06020004293 Fred Flintstone 123 Main St.
05020004293 Wilma Flintstone Bedrock Road
0302004472 Fred Jones 98 New York Ave.
------------------------------
Date: Tue, 03 Nov 2009 22:11:47 -0800
From: "John W. Krahn" <someone@example.com>
Subject: Re: How to process duplicate entries in tab separated file?
Message-Id: <JW8Im.8872$Cc6.4576@newsfe07.iad>
James Egan wrote:
> On Wed, 04 Nov 2009 00:28:45 +0000, Ben Morrow wrote:
>
>
> Here's some of the things I've tried suggested in this group:
>
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
>
> use vars qw(
> @file
> @fields
> $fields
> $line
> $ctr
> $custno
> @customers
> $customers
> %customer
> %customers
> $key
> );
>
>
> while (<DATA>) {
> chomp;
> my ($id, $fn, $ln, $addy) = split;
The address field contains whitespace so you are losing some data:
my ($id, $fn, $ln, $addy) = split ' ', $_, 4;
> $customers{$id} = "$fn, $ln, $addy" unless $customers{$key};
$key is always false so the test is superfluous:
$customers{$id} = "$fn, $ln, $addy";
You are overwriting the previous value of $customers{$id} every time $id
is a duplicate so you are losing some data.
> print "$id is duplicate: $fn $ln, $addy\n" if $customers{$id};
$customers{$id} is always true so the test is superfluous:
print "$id is duplicate: $fn $ln, $addy\n";
> }
>
>
> #local $\ = qq{\n};
> #my %h;
>
> #while (<DATA>) {
> # chomp; next unless /\S/;
> # my $custno = (split)[0];
> # print $custno if exists $h{$custno};
> # $h{$custno}++;
> #}
>
>
> __DATA__
> 07020000279 Joe Smith 54 Abbey Road
> 05020033486 John Jones 98 New York Ave.
> 07020000279 George Washington 234 Washington Ave.
> 06020004293 Fred Flintstone 123 Main St.
> 05020004293 Wilma Flintstone Bedrock Road
> 0302004472 Fred Jones 98 New York Ave.
John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity. -- Damian Conway
------------------------------
Date: Wed, 4 Nov 2009 11:44:03 -0800 (PST)
From: sharma__r@hotmail.com
Subject: Re: How to process duplicate entries in tab separated file?
Message-Id: <4453479e-d0cd-4285-9101-1ab419ebf132@e4g2000prn.googlegroups.com>
On Nov 4, 8:52=A0am, James Egan <jegan...@comcast.net> wrote:
> On Wed, 04 Nov 2009 00:28:45 +0000, Ben Morrow wrote:
>
> Here's some of the things I've tried suggested in this group:
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> use vars qw(
> =A0 @file
> =A0 @fields
> =A0 $fields
> =A0 $line
> =A0 $ctr
> =A0 $custno
> =A0 @customers
> =A0 $customers
> =A0 %customer
> =A0 %customers
> =A0 $key
> );
>
You've not removed the use vars construct as was strongly suggested in
this group.
There really is no need to go for global variables in this case.
What you can try is this code (untested though!):
#!/usr/bin/perl
use strict;
use warnings;
local $\ =3D qq{\n};
my %h;
while (<DATA>) {
chomp; next unless /\S/;
my $custno =3D (split)[0];
if (!exists $h{$custno}) {
push @{$h{$custno}}, $., $_;
}
else {
push @{$h{$custno}}, $_;
}
}
print for
map { $_->[1] }
sort { $a->[0] <=3D> $b->[0] }
map { my @A=3D@{$h{$_}}; [shift(@A), join("\n",@A)] }
keys %h;
--Rakesh
------------------------------
Date: Wed, 04 Nov 2009 12:05:13 -0800
From: sln@netherlands.com
Subject: Re: How to process duplicate entries in tab separated file?
Message-Id: <n6n3f55kavkef3omcpmdts3ikftjfm58m6@4ax.com>
On Mon, 02 Nov 2009 01:30:23 GMT, James Egan <jegan473@comcast.net> wrote:
>In the __DATA__ below, there are two duplicate entries which occur twice,
>07020000279 and 05020004293, which are customer numbers. What I need to
>do is find any duplicate customer numbers in a file, and print (write)
>them.
>
>-Thanks
>
Late to the thread. No use going over all the pro's and cons.
I would say that your natural delimeter is tab, not space.
It is unnecessary to split out first/last name's, and its useless
to think that it can be predictable.
Validation, where is the validation and defaults?
Split is far too over-used in this group. It implies a perfect
world.
Add to the list one more method ..
-sln
---------
use strict;
use warnings;
open DATA, '<id.txt' or die "can't open id data file: $!";
my %customers;
my %dups;
my $file_pos = tell(DATA);
# Validate form, store position info
while (<DATA>) {
if (my ($id) = /^ ([\w]+) \t?[\w ]* \t?([\w ]*) /x)
{
if ( exists($customers{$id}) )
{ push @{$dups{$id}}, $file_pos; }
else
{ $customers{$id} = $file_pos; }
}
$file_pos = tell(DATA);
}
# Display multiple id data
for my $id (sort keys %dups)
{
print "\nMult_Id: $id\n";
for my $position ($customers{$id}, @{$dups{$id}}) {
seek (DATA, $position, 0);
$_ = <DATA>;
my ($name, $addy) = /^ [\w]+ \t?([\w ]*) \t?([\w ]*) /x;
print "\t'$name', '$addy'\n";
}
}
close DATA;
__END__
id.txt:
07020000279 Joe Smith 54 Abbey Road
05020033486 John Jones 98 New York Ave.
07020000279 George Washington 234 Washington Ave.
06020004293 Fred Flintstone 123 Main St.
05020004293 Wilma Flintstone Bedrock Road
0302004472 Fred Jones 98 New York Ave.
05020004293 Wilma Flintstone Bedrock Road
05020004293 Bedrock Road
05020004293 Wilma Flintstone Bedrock Road
05020004293
05020004293 Bedrock Road
Output:
Mult_Id: 05020004293
'Wilma Flintstone', 'Bedrock Road'
'Wilma Flintstone', 'Bedrock Road'
'', 'Bedrock Road'
'Wilma Flintstone', 'Bedrock Road'
'', ''
'Bedrock Road', ''
Mult_Id: 07020000279
'Joe Smith', '54 Abbey Road'
'George Washington', '234 Washington Ave'
------------------------------
Date: Wed, 04 Nov 2009 23:49:42 GMT
From: James Egan <jegan473@comcast.net>
Subject: Re: How to process duplicate entries in tab separated file?
Message-Id: <qqoIm.123943$Xw3.7043@en-nntp-04.dc1.easynews.com>
On Wed, 04 Nov 2009 12:05:13 -0800, sln wrote:
> id.txt:
>
> 07020000279 Joe Smith 54 Abbey Road
> 05020033486 John Jones 98 New York Ave. 07020000279 George
Washington
> 234 Washington Ave. 06020004293 Fred Flintstone 123 Main St.
05020004293
> Wilma Flintstone Bedrock Road 0302004472 Fred Jones 98 New
York Ave.
>
> 05020004293 Wilma Flintstone Bedrock Road
05020004293 Bedrock Road
> 05020004293 Wilma Flintstone Bedrock Road 05020004293
> 05020004293 Bedrock Road
>
> Output:
>
> Mult_Id: 05020004293
> 'Wilma Flintstone', 'Bedrock Road'
> 'Wilma Flintstone', 'Bedrock Road'
> '', 'Bedrock Road'
> 'Wilma Flintstone', 'Bedrock Road'
> '', ''
> 'Bedrock Road', ''
>
> Mult_Id: 07020000279
> 'Joe Smith', '54 Abbey Road'
> 'George Washington', '234 Washington Ave'
If I change id.txt so it has two sets of two duplicate customer numbers
like:
07020000279 Joe Smith 54 Abbey Road
05020033486 John Jones 98 New York Ave.
07020000279 George Washington 234 Washington Ave.
06020004293 Fred Flintstone 123 Main St.
05020004293 Wilma Flintstone Bedrock Road
03020004472 Fred Jones 98 New York Ave.
It's only finding one of the dups, and the output is:
Mult_Id: 07020000279
'Joe Smith', '54 Abbey Road'
'George Washington', '234 Washington Ave'
Close though!
-Thanks
------------------------------
Date: Wed, 04 Nov 2009 23:54:11 GMT
From: James Egan <jegan473@comcast.net>
Subject: Re: How to process duplicate entries in tab separated file?
Message-Id: <DuoIm.123944$Xw3.68501@en-nntp-04.dc1.easynews.com>
On Wed, 04 Nov 2009 11:44:03 -0800, sharma__r wrote:
>
> print for
> map { $_->[1] }
> sort { $a->[0] <=> $b->[0] }
> map { my @A=@{$h{$_}}; [shift(@A), join("\n",@A)] } keys %h;
>
> --Rakesh
So far this is the only code that actually processes the records with
duplicate customer numbers together. But now I can't seem to format the
output. I was using the "write" function to output07020000279 formatted
data, but would be happy if I could print formatted output like:
Customer ID: 07020000279
Name: Joe Smith
Address: 54 Abbey Road
Is this possible?
-Thanks
------------------------------
Date: Wed, 04 Nov 2009 16:24:40 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: How to process duplicate entries in tab separated file?
Message-Id: <041120091624401683%jimsgibson@gmail.com>
In article <DuoIm.123944$Xw3.68501@en-nntp-04.dc1.easynews.com>, James
Egan <jegan473@comcast.net> wrote:
> On Wed, 04 Nov 2009 11:44:03 -0800, sharma__r wrote:
> >
> > print for
> > map { $_->[1] }
> > sort { $a->[0] <=> $b->[0] }
> > map { my @A=@{$h{$_}}; [shift(@A), join("\n",@A)] } keys %h;
> >
> > --Rakesh
>
>
> So far this is the only code that actually processes the records with
> duplicate customer numbers together. But now I can't seem to format the
> output. I was using the "write" function to output07020000279 formatted
> data, but would be happy if I could print formatted output like:
>
> Customer ID: 07020000279
> Name: Joe Smith
> Address: 54 Abbey Road
>
> Is this possible?
Only if you can reliably identify the name and address fields. Your
sample data contains only two-word names. Can you also have one word
names ("Cher") or three-word names ("John C. Reilly")? Can you arrange
to put a unique delimiter character between your fields? If so, then
printing the data as shown above is straight-forward: just use the
print or printf statements.
--
Jim Gibson
------------------------------
Date: Thu, 5 Nov 2009 00:26:39 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: How to process duplicate entries in tab separated file?
Message-Id: <vmi9s6-7jl.ln1@osiris.mauzo.dyndns.org>
Quoth James Egan <jegan473@comcast.net>:
> On Wed, 04 Nov 2009 11:44:03 -0800, sharma__r wrote:
> >
> > print for
> > map { $_->[1] }
> > sort { $a->[0] <=> $b->[0] }
> > map { my @A=@{$h{$_}}; [shift(@A), join("\n",@A)] } keys %h;
>
> So far this is the only code that actually processes the records with
> duplicate customer numbers together.
So far you have not shown us any code you have written yourself. If you
want someone to write the code for you, you will need to hire a
programmer.
>But now I can't seem to format the
> output. I was using the "write" function to output07020000279 formatted
> data, but would be happy if I could print formatted output like:
>
> Customer ID: 07020000279
> Name: Joe Smith
> Address: 54 Abbey Road
perldoc -f print
The section in perlop that deals with double-quoted strings.
Ben
------------------------------
Date: Wed, 04 Nov 2009 16:40:30 -0800
From: sln@netherlands.com
Subject: Re: How to process duplicate entries in tab separated file?
Message-Id: <t574f5h8tuiohfag2u3eij045j9lur2e39@4ax.com>
On Wed, 04 Nov 2009 23:49:42 GMT, James Egan <jegan473@comcast.net> wrote:
>
>If I change id.txt so it has two sets of two duplicate customer numbers
>like:
>
>07020000279 Joe Smith 54 Abbey Road
>05020033486 John Jones 98 New York Ave.
>07020000279 George Washington 234 Washington Ave.
>06020004293 Fred Flintstone 123 Main St.
>05020004293 Wilma Flintstone Bedrock Road
>03020004472 Fred Jones 98 New York Ave.
>
>It's only finding one of the dups, and the output is:
>
>Mult_Id: 07020000279
> 'Joe Smith', '54 Abbey Road'
> 'George Washington', '234 Washington Ave'
>
>
>Close though!
>
>-Thanks
Thats the problem, its not written to be 'close'.
Hashes don't lie, eyesight sometimes does.
07020000279 is the only duplicate in your data shown above.
These:
06020004293 Fred Flintstone 123 Main St.
^
05020004293 Wilma Flintstone Bedrock Road
are not duplicates!
-sln
------------------------------
Date: Wed, 04 Nov 2009 15:19:01 -0000
From: Justin C <justin.0908@purestblue.com>
Subject: Re: unintialised warning
Message-Id: <1818.4af19b65.167f6@zem>
On 2009-11-03, Jürgen Exner <jurgenex@hotmail.com> wrote:
> Justin C <justin.0908@purestblue.com> wrote:
>>On 2009-11-01, Andrew DeFaria <Andrew@DeFaria.com> wrote:
>>><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>>> my $value ||= $PAR{$name}<br>
>>
>>Why do you find it necessary to post over 100 lines of html just to
>>reply with one line? We understand your meaning by reading the text
>>that you post, not the code that your software generates. Please do
>>not post html here, plain-text only in this newsgroup.
>
> This has been discussed ad nauseum a while ago. Mr. DeFaria is resistant
> to any attempt of reasoning and therefore ended up in most peoples
> filters.
> You must have missed that thread.
Yes, I must have done. I shall make a note and not chastise the deviant
again.
Justin.
--
Justin C, by the sea.
------------------------------
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 2665
***************************************