I think I understand why my hash has initial values of ' ' from Dumper, because first time through there is no data...duh, but is there a better way to do what I am doing here? thank you!

my %hash ; my ($remote_mt,$local_mnt); while (<DATA>) { unless ( /\A#|^$/ ) { ($remote_mt,$local_mt) = +(split)[0,1] if (/nfs/i); $hash {$remote_mt} = $local_mt; } } if ( %hash ) { while ( my ($k, $v) = each(%hash) ) { print "\nKicking my dog off my leg: $k => $v\n" ; print qx(date +%x" "%X) ; } } else { print "\n", qx(date +%x" "%X) ; die "YIKES, my dog is on my leg!\n" ; } use Data::Dumper; print Dumper(\%hash);

__OUTPUT__ $ perl foo
### Here is what I refer to, no data initially ###
Kicking my dog off my leg: => 04/30/08 12:54:31 Kicking my dog off my leg: prdfs80:/var/opt/ha_prdfs80 => /var/opt/prd +fs80 04/30/08 12:54:31 Kicking my dog off my leg: dev0cl01:/home/admin => /home/admin 04/30/08 12:54:31 $VAR1 = { '' => undef, 'prdfs80:/var/opt/ha_prdfs80' => '/var/opt/prdfs80', 'dev0cl01:/home/admin' => '/home/admin' };

__DATA__ # System /etc/fstab file. Static information about the file systems # See fstab(4) and sam(1M) for further details on configuring devices. /dev/vg00/lvol3 / vxfs delaylog 0 1 /dev/vg00/lvol1 /stand hfs defaults 0 1 /dev/vg00/lvol4 /home vxfs delaylog 0 2 /dev/vg00/lvol5 /opt vxfs delaylog 0 2 /dev/vg00/lvol6 /tmp vxfs delaylog 0 2 /dev/vg00/lvol7 /usr vxfs delaylog 0 2 /dev/vg00/lvol9 /var vxfs delaylog 0 2 prdfs80:/var/opt/ha_prdfs80 /var/opt/prdfs80 nfs defaults 0 0 dev0cl01:/home/admin /home/admin nfs defaults 0 2 ~

In reply to hash with an initial key/value of ' ' by mikejones

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.