Hey Perlers!

This code used to work and then I changed something and it no longer works!
The problem is the output no longer includes "string 2a" and "string 2b".
What am I doing wrong?

How do explicitly assign an array (not an array reference, but an array) to
an array cell?

Thanks,
Sieg


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";

print concat [EMAIL PROTECTED];


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to