my @o = `./convert.sh \"$filename\"`; my @array; foreach my $line (@o) { next if ($line =~ /^\s*$/); my %obj; my $error = getRecordObject($line,\%obj); print "Error code returned is $error for record\n$line\n" if ($error<0); push @array, \%obj; } .... doing something print "Total Records : ".scalar(@array)."\n"; #### cat ../file.converted | wc -l 12715