in reply to Re: Pattern match for split() - need match but not match syntax
in thread Pattern match for split() - need match but not match syntax
use strict; use warnings; use Data::Dumper; my $app_text = qq{one:partridge\ntwo:\nturtle doves\nthree:french hens\n}; my %fvPairs = map { split m{:\n?} } map { split m{(?<!:)\n} } $app_text; print Data::Dumper->Dumpxs( [ \ %fvPairs], [ q{*fvPairs} ] );
produces ...
%fvPairs = ( 'three' => 'french hens', 'one' => 'partridge', 'two' => 'turtle doves' );
Cheers,
JohnGG
|
|---|