On Jul 30, Matija Papec said:
>my $i;
>my (@datumi2) = (1..100);
>my (@temp, @data);
>
># block for optimization
>
>for $i (0..$#datumi2) { push @temp, "" }
>push @data, \@temp;
>undef @temp;
>
># end of block for optimization
>
>push @data, \@datumi2;
You can use the length of an array with the x (repetition) operator, and
get a nifty thing like:
@array = ( 1 .. 100 );
@blanks = ("") x @array;
Now @blanks is 100 elements of "".
Oh, you have a problem with your code:
$x = \@foo;
undef @foo;
That kills the underlying array that $x refers to. You'd need to do
$x = [ @foo ];
undef @foo;
But that's not needed to do what you want:
@data = (
[ ("") x @datumi2 ],
\@datumi2,
);
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]