in reply to Re: sorting headers in a file
in thread sorting headers in a file
I would write
assub{$h{$1} = $2 if /(\d+)\n\n(\w+)/}->() foreach <DATA>;
/(\d+)\n+(\w+)/ and $h{$1} = $2 for <DATA>;
which I think is more readible. The modification of the regex makes it a little more robust relative to the formatting of the data. You would also lose data if there are duplicate ">or..." bits and multiline sequences.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: sorting headers in a file
by Lennotoecom (Pilgrim) on Dec 13, 2013 at 08:47 UTC |