Recommend reading perldsc#!/usr/bin/env perl use strict; use warnings; use Data::Dump; my $hashRef; # See Perldoc perldsc my $lastSeen; for (<DATA>) { length or next; chomp; if (!/^physicaldrive/) { $lastSeen=$_; } else { push @{$hashRef->{$lastSeen}},$_; } } my @arrayA = @{$hashRef->{'array A'}}; dd @arrayA; my $secondDiskArrayA = $hashRef->{'array A'}[1]; dd $secondDiskArrayA; my $unassignedDisks = $hashRef->{unassigned}; dd $unassignedDisks; dd $unassignedDisks->[0];
In reply to Re: Join multiple lines in a string based on regex.
by trippledubs
in thread Join multiple lines in a string based on regex.
by pr33
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |