I don't understand the output you want, but it is simple to stuff it all into a hash-of-hashes data structure (perldsc). UPDATE: I mistakenly left the "next" line in there from the OP's code. It is unnecessary, and I have commented it out.
#!/usr/bin/env perl use Data::Dumper; use strict; use warnings; my %data; while (<DATA>) { #next unless /^aixFsMountPoint|aixFsSize|aixFsFree/i; if ( /(\w+).(\d+)\s*=\s*(.*)/ ) { $data{$1}{$2} = $3; } } print Dumper(\%data); __DATA__ actual STDOUT: aixFsMountPoint.1 = "/" aixFsMountPoint.2 = "/usr" aixFsMountPoint.3 = "/var" aixFsMountPoint.4 = "/tmp" aixFsMountPoint.5 = "/local.home" aixFsMountPoint.6 = "/admin" aixFsMountPoint.7 = "/proc" aixFsMountPoint.8 = "/opt" aixFsMountPoint.9 = "/var/adm/ras/livedump" aixFsMountPoint.10 = "/net" aixFsMountPoint.11 = "/net/nim01at/opt/CBC-CFG" aixFsMountPoint.12 = "/net/nim01at/opt/CBC-CFG" aixFsSize.1 = 3072 aixFsSize.2 = 8512 aixFsSize.3 = 10240 aixFsSize.4 = 4096 aixFsSize.5 = 64 aixFsSize.6 = 128 aixFsSize.7 = 0 aixFsSize.8 = 4096 aixFsSize.9 = 3072 aixFsSize.10 = 0 aixFsSize.11 = 7168 aixFsSize.12 = 7168 aixFsFree.1 = 2631 aixFsFree.2 = 3232 aixFsFree.3 = 2373 aixFsFree.4 = 1923 aixFsFree.5 = 46 aixFsFree.6 = 127 aixFsFree.7 = 0 aixFsFree.8 = 3000 aixFsFree.9 = 3071 aixFsFree.10 = 0 aixFsFree.11 = 3463 aixFsFree.12 = 3463
prints...
$VAR1 = { 'aixFsFree' => { '6' => '127', '11' => '3463', '3' => '2373', '7' => '0', '9' => '3071', '12' => '3463', '2' => '3232', '8' => '3000', '1' => '2631', '4' => '1923', '10' => '0', '5' => '46' }, 'aixFsMountPoint' => { '6' => '"/admin"', '11' => '"/net/nim01at/opt/CBC-CFG"', '3' => '"/var"', '7' => '"/proc"', '9' => '"/var/adm/ras/livedump"', '12' => '"/net/nim01at/opt/CBC-CFG"', '2' => '"/usr"', '8' => '"/opt"', '1' => '"/"', '4' => '"/tmp"', '10' => '"/net"', '5' => '"/local.home"' }, 'aixFsSize' => { '6' => '128', '11' => '7168', '3' => '10240', '7' => '0', '9' => '3072', '12' => '7168', '2' => '8512', '8' => '4096', '1' => '3072', '4' => '4096', '10' => '0', '5' => '64' } };

In reply to Re: hash question by toolic
in thread hash question by dbs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.