Siegfried Heintze wrote: > 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. > When you look at the output fo Data::Dumper: $VAR1 = [ 'string 1', 'string 2', [ 'string 3', 'string 2a', 'string 2b' ] ]; It is an array.
Wags ;) > >> >> 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 ******************************************************* This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. ******************************************************* -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>