On 6/12/07, James <[EMAIL PROTECTED]> wrote:
Is there a way of writing a regex to find 1 or more occurances of specific
text string, and replace with a single occurance.
Possibly, but using a hash is a lot easier and probably more efficient:
#!/usr/bin/perl
use strict;
use warnings;
my %h;
while (<DATA>) {
print unless $h{$_}++
}
__DATA__
AAAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAA
BBBBBB
NNNNNNNNNNN
NNNNNNNNNNN
CCCCCCCCC
CCCCCCCCC
CCCCCCCCC
CCCCCCCCC
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/