in reply to Please fix my writing style
Another perlish solution:
my %teams = do { local $/; <DATA> =~ /^([A-Z\s]+?):\s*(.+)$/mg; };The do block is most helpful here to override $/ in the block and leave it unchanged elsewhere. local $/; turns on file slurping. A match in list context returns a list of all our submatches in parenthesis, which go to our hash.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Please fix my writing style
by convenientstore (Pilgrim) on Nov 22, 2008 at 16:43 UTC | |
by juster (Friar) on Nov 22, 2008 at 19:48 UTC | |
by convenientstore (Pilgrim) on Nov 23, 2008 at 03:53 UTC | |
|
Re^2: Please fix my writing style
by convenientstore (Pilgrim) on Nov 22, 2008 at 16:40 UTC |