http://qs321.pair.com?node_id=123484

silent11 has asked for the wisdom of the Perl Monks concerning the following question:

I was given an Access database which I am trying to get into MySQL, I read through the documentation on mysqlimport and it said that it was only capable of importing text files. So I export my Access DB into a pipe delimited file, pipes delimiting the fields, and newlines delimiting the records. Well, to make a long story short, M$ Access's Export feature sucks, many of my rows were divided on whitespaces which resulted single lines looking like the following
3884|MC1|GW|Graphworks/Mirandas Needle|kit |Mice Skating|EACH|$1.50|$0.75|MC1.JPG

My question is, how do I remove the newline '\n' on a line if the next line doesn't start with a 3-5 digit number and then print that new complete line to a seperate file?

This is what I have so far, and it doesn't work.
open (PROD,"<products.txt"); open (OUT,">out.txt"); @array = <PROD>; foreach $line (@array){ unless ($line =~/JPG?/){ chomp; } print OUT "$line"; }

any help would be appreciated.