in reply to Help w passing array by ref

I think this is what you are wanting to do. I hope
this helps.

sub makeSql { my $xpid = shift; my $return; my $i = 0; foreach my $item (@$xpid) { $return .= $xpid[$i]; $i++; } return $return; }

rlb3

Replies are listed 'Best First'.
Re: Re: Help w passing array by ref
by kesterkester (Hermit) on Oct 10, 2003 at 16:23 UTC
    Using a leading "r_" on references can help to keep track of things, mnemonic-wise:
    sub makeSql { my $r_xpid = shift; my $return = ""; $return .= $r_xpid->[$_] foreach 0 .. scalar @$r_xpid - 1; return $return; }