http://qs321.pair.com?node_id=908753

PoGGiE has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I'm having a problem referencing/returning my hash arrays and thought I would ask here ... I've been stuck on this for 2 days already trying to read/understand perldocs etc.! pretty new to Perl so apologies if this is a super-n00b question.
I'm trying to pass an array of hash arrays to-and-from a sub.
E.g. : $F_SCORE$i{$co})where $i is the year counter, and $co is a company name string.

My basic code is this:

At end of sub:

    return (\@date, \@F_SCORE, \@F_SCORE_BOX, \@F_ROA, \@F_CFO, \@F_dROA, \@F_ACCRUAL, \@F_dLEVER, \@F_dLIQUID, \@F_EQOFFER, \@F_dTURN, \@F_dMARGIN);

then in main:

my ($date_ref, $F_SCORE_ref, $F_SCORE_BOX_ref, $F_ROA_ref, $F_CFO_ +ref, $F_dROA_ref, $F_ACCRUAL_ref, $F_dLEVER_ref, $F_dLIQUID_ref, $F_E +QOFFER_ref, $F_dTURN_ref, $F_dMARGIN_ref) = piotroski (\@balancesheet +s, \@cashflows, \@pnl, \@cdata, $co_name, $yahoo_isin, $co_exchange, +$statement_cur, $px_cur); my (@date, @F_SCORE, @F_SCORE_BOX, @F_ROA, @F_CFO, @F_dROA, @F_ACC +RUAL, @F_dLEVER, @F_dLIQUID, @F_EQOFFER, @F_dTURN, @F_dMARGIN) = (@$d +ate_ref, @$F_SCORE_ref, @$F_SCORE_BOX_ref, @$F_ROA_ref, @$F_CFO_ref, +@$F_dROA_ref, @$F_ACCRUAL_ref, @$F_dLEVER_ref, @$F_dLIQUID_ref, @$F_E +QOFFER_ref, @$F_dTURN_ref, @$F_dMARGIN_ref); print "/$date[0]{$co_name}\t$date[1]{$co_name}\t$date[2]{$co_name} +\t$date[3]{$co_name}\t$date[4]{$co_name}\n"; print "/$F_SCORE[0]{$co_name}\t/$F_SCORE[1]{$co_name}\t/$F_SCORE[2 +]{$co_name}\t/$F_SCORE[3]{$co_name}\t/$F_SCORE[4]{$co_name}\n";


Confusingly for me, $date prints each element just fine, whereas none of the others seem to contain any data (that I have find). In the sub itself, they work fine and I can dump F_Score (and other) values to the screen.

Kinda stumped and thought some kind soul here might have an idea! (I'm sure there is a better way to do this too ... I'm all ears!)

Thanks,

Carl