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:

   unshift(@ar, $_ == 1 ? pop @ar : (pop @ar, '|')) foreach [EMAIL PROTECTED];

map might be faster; benchmark it.

HTH,

-- jay
--------------------------------------------------
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.dpguru.com  http://www.engatiki.org

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