open(IN, " reads lines from the file, feeding that list to the map. # split(/\|/, $_) creates a list of the the pipe-delimted elements # [ ] creates an anonymous array ref to that list. # Finally the map returns the resulting list of array refs. my @foo = map { [(split(/\|/, $_))] } ; close(IN); # Just to prove that it worked. foreach (@foo) { print join(' -- ', @$_), "\n"; }