On Mon, Jul 30, 2001 at 08:02:58PM +0200, Matija Papec wrote:
> ok, to simplify let's suppose that
>
> @datumi2 = (1, 2, 3);
>
> #so final result should look like this:
> @data[0] = ("", "", "");
> #and
> @data[1] = (1, 2, 3);
This notation is almost certainly incorrect, what you probably meant to say
is:
$data[0] = ["", "", ""];
$data[1] = [ 1, 2, 3];
or
@{ $data[0] } = ("", "", "");
@{ $data[1] } = ( 1, 2, 3);
The assignments you showed will result in:
$data[0] = "";
$data[1] = 3;
along with various warnings.
> I want to make @data[0] on the fly without "for" structure and it should
> have the same number of elements as @datumi2.
Your restriction that it not use a for loop to construct the data is
needlessly limiting. There are several ways to do what you ask, one of them
is a for loop.
push(@{ $data[0] }, "") for (0 .. $#datumi2);
OR
push(@{ $data[0] }, "") for @dataumi2;
OR
$data[0] = [("") x @datumi2];
Each has strengths and weaknesses.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]