in reply to How do I search and output results to HTML from a CSV database file?
nice soultions everyone, but sadly not for this problem. You are all parsing space-seperated data, but Sasquires data ist in fixed-width fields.
If you've got just a few fixed-width fields, you might want to try substr. If you have many fields, I would recommend unpack, like so:
while(<DATA>) @data = unpack("A8A10A2",$_); print join(",", @data), "\n"; } __DATA__ 12345678123456789012 longone evenlongerha a b c
the template string "A8A10A2" tells unpack to look for 8 Ascii Characters, then 10 Ascii Characters, then 2 Ascii Characters. unpack is also used a lot in handling binary data (which I don't understand). I just stick to this usage.
-- Brigitte 'I never met a chocolate I didnt like' Jellinek http://www.horus.com/~bjelli/ http://perlwelt.horus.at
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How do I search and output results to HTML from a CSV database file?
by larryk (Friar) on May 15, 2001 at 16:59 UTC | |
by buckaduck (Chaplain) on May 15, 2001 at 18:52 UTC |