#!/usr/bin/perl use strict; use Data::Dumper; my %HoH; while (<DATA>) { next if (/^Surname/ or /^--/); s/(\w+)\s+(\w+\s?\w+?)\s+(\w+)//; $HoH{$1} = { $2 => $3 }; } print Dumper \%HoH; __DATA__ Surname L20, First Name L20, Town L20 -------------------------------------------------- Chaplin Charlie Basel Estevez Emilio Santa Manica Sarte Jean Paul Montmarte Rikard Frank Amsterdam Rodin Paul Montmarte
In reply to Re: How to read data file into an array of hashes
by bichonfrise74
in thread How to read data file into an array of hashes
by fseng
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |