Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Using the map function

by 2teez (Priest)
on Jul 10, 2013 at 18:28 UTC ( #1043525=note: print w/replies, xml ) Need Help??

in reply to Using the map function

Hi cspctec,
For me, using HASH of ARRAYs, could easily get this done for you like so:

use warnings; use strict; use Data::Dumper; my %hash; while (<DATA>) { chomp; next if /^\s*$/; my $key = $1 if /\w+?\s+?(.+?)\s+/; push @{ $hash{$key} }, $_; } print Dumper \%hash; __DATA__ CPU Temp = 30 GFX Temp = 45 RAM Temp = 40 CPU Status = OK GFX Status = OK RAM Status = OK
... produces ...
$VAR1 = { 'Temp' => [ 'CPU Temp = 30 ', 'GFX Temp = 45 ', 'RAM Temp = 40 ' ], 'Status' => [ 'CPU Status = OK ', 'GFX Status = OK ', 'RAM Status = OK' ] };

For more info. Please see perldsc
If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043525]
[choroba]: I can't connect to (www. or not)
[choroba]: .com works slowly, .net is fine

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2017-01-22 20:26 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (190 votes). Check out past polls.