in reply to Re^3: Arrow operator usage in perl
in thread Arrow operator usage in perl

this is my Code block may be u can help me out of this

sub gethpux1131hwwns {         my $hwwns;         my $hwpath;         my $hwwn;         my @fcdevices = `ioscan -kfnNC fc | grep "/dev/" 2>/dev/null`;         foreach my $fcdev(@fcdevices) {                 my @fcdump = `fcmsutil $fcdev`;                 foreach my $ln (@fcdump) {               if($ln =~ /Hardware Path is/)               {               (my $pathname, $hwpath) = split('= ', $ln);                         chomp($hwpath);               }              elsif($ln =~ /N_Port Port World Wide Name/)                {                (my $hwwnname, $hwwn) = split('= ', $ln);                            chomp($hwwn);                }              }                $hwwns->{$hwpath} = $hwwn;         }         return $hwwns; }

Replies are listed 'Best First'.
Re^5: Arrow operator usage in perl
by Kenosis (Priest) on Nov 09, 2013 at 19:35 UTC

    Ah! The subroutine only returns a hash reference, like the following:

    use strict; use warnings; use Data::Dumper; my $hashRef = getHashRef(); print Dumper \$hashRef; print $hashRef->{'Hello'}; sub getHashRef { my $hwwns; $hwwns->{'Hello'} = 'world!'; return $hwwns; }

    Output:

    $VAR1 = \{ 'Hello' => 'world!' }; world!