So what your are looking for is something to read the file:

open (IN, "<barcodes.txt") or die "Argh, failed to open barcodes.txt - $!";
while ( <IN> ) {
# Clean it up a little bit
chomp;
# lets just keep the digits
$_ =~ s/\D*//g; # Replace anything that is not a digit with nothing
# Print anything that is not 14 characters in length
if ( length($_) <> 14 ) { print $_ . "\n" }
}
close ( IN );

Should do the trick though I bet there are faster ways of doing this on a
single line even....

Regards,

Rob Coops

On 10/13/06, Jack Daniels (Butch) <[EMAIL PROTECTED]> wrote:

Have spent the last couple hours searching Internet, reading my perl
books,
but I just can't figure it out.

Problem:
Our barcodes are 14 digits, however not all employees have a scanner when
associating the barcode with an item.
Barcodes are then manually entered and are not always entered correctly.

I would like to extract all barcodes that are not 14 digits from a file of
all the barcodes in the system so we can correct them.
Some barcodes for whatever reason were entered with a dash. Not good
In the meantime, I'll keep looking for a solution the hard way, Internet.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Reply via email to