Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Unable to get the paragraph in the list of hashes. Getting single lines instead.

by tybalt89 (Prior)
on Sep 22, 2020 at 14:39 UTC ( #11122087=note: print w/replies, xml ) Need Help??


in reply to Unable to get the paragraph in the list of hashes. Getting single lines instead.

It's really logically a one-liner

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11121971 use warnings; my @answer = grep %$_, # ignore empty hashs map +{ /^\h*(.*?)\h*= (.*)/gm }, # convert a paragraph to anon hash + by lines do { local $/ = ''; <DATA> }; # get list of paragraphs use Data::Dump 'dd'; dd \@answer; __DATA__ ..... data section same as my other example .....

( Shown on multiple lines with comments added to avoid annoying GrandFather :)

  • Comment on Re: Unable to get the paragraph in the list of hashes. Getting single lines instead.
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2020-10-22 00:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (225 votes). Check out past polls.

    Notices?