See comments in line: >> sub concat { >> # All arguments are assumed to be strings or nested arrays of >> strings. # Concatenate all elements of all arguments. >> return join "", map ref eq "ARRAY" ? concat( @$_ ) : $_, @_ } >> >> my @sResult = (); >> push @sResult, "string 1"; >> push @sResult, "string 2"; >> >> my $nMark = @sResult; >> >> push @sResult, (); # make an array of an array cell: does not work >> >> push @sResult = "string 3"; > >> >> [EMAIL PROTECTED] = "string 2a"; >> [EMAIL PROTECTED] = "string 2b"; >> > If you want the array, then change above two lines: > > $sResult[$nMark] = ["string 2a", "string 2b"] ;
(1) Does $sResult[$nMark] contain an array reference or an array? I want it to contain an array. > > But the way this is, the 'string 3' will be replaced. if want to keep the string 3, then I did a > (2) Why is this necessary? I did a push to create a gap. Why is not my "push @sResult, ();" creating a gap? > if ( defined $sResult[$nMark] ) { > $sResult[$nMark] = [$sResult[$nMark], "string 2a", "string 2b"] ; > > }else { > $sResult[$nMark] = ["string 2a", "string 2b"]; > } > Thanks! Siegfried -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>