Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Applying regex to each line in a record.

by tybalt89 (Prior)
on Oct 24, 2020 at 21:20 UTC ( #11123137=note: print w/replies, xml ) Need Help??


in reply to Applying regex to each line in a record.

I tried paragraph mode, still didn't need /s and /m. :)

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11123126 use warnings; local $/ = ''; # paragraph at a time my %hash = map { $1 x /(\w+):\n/, { /(\w+):(\w+)/g } } <DATA>; use Data::Dump 'dd'; dd \%hash; __DATA__ first: this:that here:there when:what how:where now:later name:onlyfirst second: this:that here:there when:what how:where now:later name:onlysecond

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11123137]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2021-01-18 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?