I am writing a perl script to import data from one source into another. I am presented with data inconsistencies in the addresses.
In the destination DB, we have fields for 3 address lines, city, county, Postcode, etc. The data I am importing inly has one address field, with commas seperating what should be each line in an address. Splitting this out is mostly trivial, except some addresses have 4 or 5 lines, the data appears as
address1, address2, address3, address4, address5
city
county
postcode
What I want to do is split into 3 groups, but from right to left, so I would get
address1, address2, address3,
address4
address5
city
county
postcode
How would I manage this?
In the destination DB, we have fields for 3 address lines, city, county, Postcode, etc. The data I am importing inly has one address field, with commas seperating what should be each line in an address. Splitting this out is mostly trivial, except some addresses have 4 or 5 lines, the data appears as
address1, address2, address3, address4, address5
city
county
postcode
What I want to do is split into 3 groups, but from right to left, so I would get
address1, address2, address3,
address4
address5
city
county
postcode
How would I manage this?