The module
Geo::Postcode may be of use in recognising the last line of a block as a (UK) postcode. Apparently there are a few gotchas among UK postcodes, that diverge from thhe expected patterns.
It may be a bit of a sledge-hammer to crack a nut: the module also is able to do lots of good geo stuff you don't need -
Geo::Postcode will accept full or partial UK postcodes, validate them against the official spec, separate them into their significant parts, translate them into map references or co-ordinates and calculate distances between them.
It does not check whether the supplied postcode exists: only whether it is well-formed according to British Standard 7666
but still could be helpful.
This signature will be ready by a Christmas