in reply to Help Extract these lines
For any of the proposed codes to work, the "id" and "name" entries have to come on alternating lines. Under this assumption, we do not need to bother reading line by line:
use strict; use warnings; use Data::Dumper; { local $/; $_=<DATA>; } my %rec = reverse /"([^:]*?)",/g; print Dumper \%rec; __DATA__ "id": "xx-ada-qwebasd", "name": "telphone", "id": "fasda-asd-123123-fkja123a", "name": "car", "id": "97f921-a312-fas2", "name": "ball",
|
|---|