Beefy Boxes and Bandwidth Generously Provided by pair Networks
Joe Think about Loose Coupling  Anyone for UIEE?  by Cody
Fendant (Pilgrim) on Aug 30, 2010 at 23:32 UTC
( #858093=perlquestion: print w/ replies, xml ) Need Help??  I
recently had to write code to parse files in UIEE format. Have
any monks come across it before?  There isn't anything on CPAN
which I could find, although there were some plaintive,
unanswered cries for help out there on sites like Experts
Exchange. It's a rather old-fashioned format, but still used in
the book trade. Some booksellers use it to upload their
inventories to Amazon, I believe.  Parsing an actual file is
incredibly simple, I did it roughly like this:  $/ = "\r\n\r\n";
open( UIEEFILE, '<', '/path/to/file.txt' ); while (<UIEEFILE>) {
my %book = (); foreach my $line ( split( "\r\n", $_ ) ) { my (
$key, $value ) = split( /\|/, $line, 2 ); if ( defined(
$book{$key} ) ) { $book{$key} .= " $value"; } else { $book{$key}
= $value; } # do something with %book } }  Though that doe