Bryan R Harris wrote:
As a sidenote, are questions like this appropriate for the list? I really
don't *need* help with this, I was just hoping to expand my personal toolbox
with a better way to do something. Every time John, Wiggins, Luke, Bob,
Jeff, etc. respond to my emails I know I'm going
Tom Allison wrote:
John W. Krahn wrote:
for ( my $i = @tmp; --$i; ) {
splice @tmp, $i, 0, '|';
}
How does this fare for large arrays?
According to my tests it does poorly on large arrays.
John
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:
Subject: cool tricks for inserting element into array?
I'd like to turn array @tmp from:
(1,2,3)
to
(1,|,2,|,3)
I'm using:
@tmp = split(' ', join( | , @tmp));
... but it seems like a waste to create a string and then split it back up
again.
As a sidenote, are questions like this
Subject: RE: cool tricks for inserting element into array?
Subject: cool tricks for inserting element into array?
I'd like to turn array @tmp from:
(1,2,3)
to
(1,|,2,|,3)
I'm using:
@tmp = split(' ', join( | , @tmp));
... but it seems like a waste to create a string
On Jul 20, Bryan R Harris said:
I'd like to turn array @tmp from:
(1,2,3)
to
(1,|,2,|,3)
@tmp = split(' ', join( | , @tmp));
... but it seems like a waste to create a string and then split it back up
again.
It would also break if elements of @tmp had spaces in them.
Well, here's
Bryan R Harris wrote:
I'd like to turn array @tmp from:
(1,2,3)
to
(1,|,2,|,3)
I'm using:
@tmp = split(' ', join( | , @tmp));
... but it seems like a waste to create a string and then split it
back up again.
I'll bet that's pretty efficient. The problem would come if
Neat, thanks!
- Bryan
On Jul 20, Bryan R Harris said:
I'd like to turn array @tmp from:
(1,2,3)
to
(1,|,2,|,3)
@tmp = split(' ', join( | , @tmp));
... but it seems like a waste to create a string and then split it back up
again.
It would also break if elements of @tmp
Bryan R Harris wrote:
I'd like to turn array @tmp from:
(1,2,3)
to
(1,|,2,|,3)
I'm using:
@tmp = split(' ', join( | , @tmp));
... but it seems like a waste to create a string and then split it back up
again.
I can think of two ways to do it:
splice @tmp, $_, 0, '|'
John W. Krahn wrote:
Bryan R Harris wrote:
I'd like to turn array @tmp from:
(1,2,3)
to
(1,|,2,|,3)
I'm using:
@tmp = split(' ', join( | , @tmp));
... but it seems like a waste to create a string and then split it back up
again.
I can think of two ways to do it:
splice @tmp,
John W. Krahn wrote:
Bryan R Harris wrote:
I'd like to turn array @tmp from:
(1,2,3)
to
(1,|,2,|,3)
I'm using:
@tmp = split(' ', join( | , @tmp));
... but it seems like a waste to create a string and then split it back up
again.
I can think of two ways to do it:
splice @tmp,
On 7/20/05, Bryan R Harris [EMAIL PROTECTED] wrote:
I'd like to turn array @tmp from:
(1,2,3)
to
(1,|,2,|,3)
I'm using:
@tmp = split(' ', join( | , @tmp));
... but it seems like a waste to create a string and then split it back up
again.
I would do something like:
Jay Savage wrote:
On 7/20/05, Bryan R Harris [EMAIL PROTECTED] wrote:
I'd like to turn array @tmp from:
(1,2,3)
to
(1,|,2,|,3)
I'm using:
@tmp = split(' ', join( | , @tmp));
... but it seems like a waste to create a string and then split it back up
again.
I would do something
John W. Krahn wrote:
John W. Krahn wrote:
Bryan R Harris wrote:
I'd like to turn array @tmp from:
(1,2,3)
to
(1,|,2,|,3)
I'm using:
@tmp = split(' ', join( | , @tmp));
... but it seems like a waste to create a string and then split it back up
again.
I can think of two ways to do it:
John W. Krahn wrote:
Bryan R Harris wrote:
I'd like to turn array @tmp from:
(1,2,3)
to
(1,|,2,|,3)
I'm using:
@tmp = split(' ', join( | , @tmp));
... but it seems like a waste to create a string and then split it back up
again.
FYI, I ran a benchmark on the different algorithms
14 matches
Mail list logo