in reply to Optimal way to read in pipe delimited files

I don't know about 'optimal', really. The code you list implies that you can rely on having 4-element rows, so this might be some fun:

while (<SRC>) { $prod{$1} = [$2,$3,$4] if m{(.+?)\|(.+?)\|(.+?)\|(.+)}; }

Or, another more general approach with regex captures, which works with any data size:

while (<SRC>) { @{ $prod{$1} } = split('\|', $2) if m/^(.+?)\|(.+)/; }

Of course, I doubt those are very fast, compared to, say:

while (<SRC>) { my @row = split(/\|/, $_); $prod{$row[0]} = \@row[1..$#row]; #using a slice; }
<-radiant.matrix->
A collection of thoughts and links from the minds of geeks
The Code that can be seen is not the true Code
"In any sufficiently large group of people, most are idiots" - Kaa's Law