Look at where $hwwns is defined.

As you've only pasted a bit of code out of context we really don't have much to go on here.

$hwwns->{$hwpath} = $hwwn assigns the value of $hwwn to the KEY named with the value of $hwpath

the hash ref $hwwns was "declared somewhere else"(TM) within your code that you have not shared with us

Here's a quick example to show you how hash references work:

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; # Declare the hash reference with an empty hash my $hash = {}; # assign the value "bar" to the key foo $hash->{foo} = 'bar'; # This prints the values in the hash # $VAR1 = { # 'foo' => 'bar' # }; print Dumper $hash; # you can retrieve the value by specifying the hash key directly also # prints "bar" print $hash->{foo} . "\n"; # we can use variables to assign key names: foreach my $key (qw(abc def lmnop zaxy)) { my $value = reverse $key; $hash->{$key} = $value; } # since this is test data, I've just reversed the key names # to show the differentiation between $KEY and $VALUE # Now our hash looks something like this: # $VAR1 = { # 'zaxy' => 'yxaz', # 'lmnop' => 'ponml', # 'def' => 'fed', # 'abc' => 'cba', # 'foo' => 'bar' # }; print Dumper $hash;

If you can provide more information, like a full sub definition, we can probably provide a more definite answer.


In reply to Re^3: Arrow operator usage in perl by three18ti
in thread Arrow operator usage in perl by dvinay

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.