Next | Program Repair Shop | 140 |
Subject: Match Parsing Glitch Message-Id: <3B046663.DB985D9C@xx.com>
$line =~ m/\d{3}\s\d{6}\W(\W{7})\s{4}(\W{10})\s{2}\d{2}\/\D{2}\/\d{2}\s(.{5,25})/;
The data had this format:
003 046926 MXF 08 1/1/5 $2,400,000 22/NO/00 4285 AN ADDRESS HERE C5D5
This is a fixed-format record; the fields have fixed lengths
Perl's tool for dealing with fixed-format records is unpack
($vendor, $price, $address) = unpack "x11 A7 x4 A10 x11 A25", $line;
Next | Copyright © 2002 M. J. Dominus |