Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

by tybalt89 (Monsignor)
on Sep 20, 2020 at 23:08 UTC ( [id://11121979]=note: print w/replies, xml ) Need Help??


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

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11121971 use warnings; my @answer; { local $/ = ''; while( <DATA> ) { /=/ and push @answer, { /^\h*(\S.*?\S)\h*= (.*)/gm }; } } use Data::Dump 'dd'; dd \@answer; __DATA__ Storage system address: 192.168.1.2 Storage system port: 443 HTTPS connection 1: ID = disk_dpe_0_0 Enclosure = DPE_0 Slot = 0 Name = DPE Disk 0 Health state = OK (5) Health details = "The component is operating normally. No ac +tion is required." Type = SAS Capacity = 288196762624 (268.4G) Rotational speed = 15000 rpm User capacity = 236420176896 (220.2G) Pool = performance Current speed = 6 Gbps Maximum speed = 6 Gbps Manufacturer = SEAGATE Model = STE30065 CLAR300 Vendor capacity = 322122547200 (300.0G) Part number = 005049273 Serial number = 6SJ2C6MV Firmware revision = ES0E WWN = 06:00:00:00:05:00:00:00:00:00:00:00:00:00:00 +:03 2: ID = disk_dpe_0_1 Enclosure = DPE_0 Slot = 1 Name = DPE Disk 1 Health state = OK (5) Health details = "The component is operating normally. No ac +tion is required." Type = SAS Capacity = 288196762624 (268.4G) Rotational speed = 15000 rpm User capacity = 236420176896 (220.2G) Pool = performance Current speed = 6 Gbps Maximum speed = 6 Gbps Manufacturer = SEAGATE Model = STE30065 CLAR300 Vendor capacity = 322122547200 (300.0G) Part number = 005049273 Serial number = 6SJ28QF3 Firmware revision = ES0E WWN = 06:00:00:00:05:00:00:00:01:00:00:00:01:00:00 +:03

Replies are listed 'Best First'.
Re^2: Unable to get the paragraph in the list of hashes. Getting single lines instead.
by GrandFather (Saint) on Sep 20, 2020 at 23:21 UTC

    Golf and pedagogy are generally incompatible. To turn your node into something useful to the OP you should deconstruct your code and describe each facet.

    Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
Re^2: Unable to get the paragraph in the list of hashes. Getting single lines instead.
by pritesh_ugrankar (Monk) on Sep 21, 2020 at 21:50 UTC

    Hi tybalt89,

    Thank you for this answer. There's a lot to learn from this for me.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-28 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found