push @colvalues1, $allcols[0],':',$allcols[1],"\n";
This pushes 4 separate values onto the array. If @colvalues1 was empty before the operation, the push populates it like this:
17:27 >perl -MData::Dump -wE "my @allcols = ('abc', 'def'); my @colval +ues1; push @colvalues1, $allcols[0],':',$allcols[1],qq[\n]; dd \@colv +alues1;" ["abc", ":", "def", "\n"] 17:27 >
Perhaps you intended to concatenate these 4 fields into a single string?
17:28 >perl -MData::Dump -wE "my @allcols = ('abc', 'def'); my @colval +ues1; push @colvalues1, $allcols[0].':'.$allcols[1].qq[\n]; dd \@colv +alues1;" ["abc:def\n"] 17:29 >
That is, replace the commas (which produce a list) with dots (which concatenate).
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: push values to an element of an array and read the same
by Athanasius
in thread push values to an element of an array and read the same
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |