i have an array of hashes to be returned.
before returning the array i cross checked it. it was working fine.
but after returning the array of hashess to the calling sub, i am not able to read it.
plz find the below code for referrence.. and do let me know how to read/ return an array of hashes
Thanks... :)
#!/usr/bin/perl
use strict;
use warnings;
# Subroutine prototypes
sub get_two_arrays();
my @one=();
@one = get_array_Hashes();
print "\n First: @one->{Version}\n"; // Printing the return array of hashes
sub get_array_Hashes() {
my @dotNetHashArray =();
my $dotNetHash1 = {Version => "Test-1 Version", SP => "installedSp", Build => "installedBuild"};
push @dotNetHashArray, $dotNetHash1;
my $dotNetHash2 = {Version => "Test-2 Version", SP => "installedSp", Build => "installedBuild"};
push @dotNetHashArray, $dotNetHash2;
my $dotNetHash3 = {Version => "Test-3 Version", SP => "installedSp", Build => "installedBuild"};
push @dotNetHashArray, $dotNetHash3;
print "Test Array of hashes before return";
for(my $i=0; $i<@dotNetHashArray; $i++)
{
print("\n Hash Value : ".$dotNetHashArray[$i]->{Version});
}
return \@dotNetHashArray
}