John W. Krahn wrote:
M. Lewis wrote:
I now we can push (concatenate) data onto an array.

I would assume that we could concatenate data on to a string as well
with something like:

$newstring = $oldstring . $newdata

Yes.

Maybe this isn't correct though. I've not yet tried it.

My question is one method 'better' than the other? If so, why so?

Assuming there is no difference, then perhaps the determination of which
to use is dependent entirely on what is to be done with the data later
in the program.

It depends on the data and what you want to do with it.  Strings and string
operations are usually more efficient than arrays and although most arrays can
be simulated using strings there are some list/array operations that are not
possible or harder to do on strings.

So what kind of data are you talking about?  :-)


I'll try to explain. And from what you and Leonid have said thus far, I don't think it really matters whether I use strings or arrays in this case.

@flintstones = q(Fred Barney Wilma Betty);

I'm NOT referring to an array with this type of data in it.

Many times I will do a whois lookup and push it onto an array, then do a couple of telnet sessions and push it onto an array, then when done, use the array as the body of a mail message. So I guess while technically it is an array, I'm not manipulating the data in the array (other than to fill it). More of a temporary holding variable for data.

What got me started thinking about the strings was just wondering if I could accomplish the same type thing with strings. And as you and Leonid have shown, yes, I can.

Hope this makes sense.

Thanks again John and Leonid.

Mike

--

 Don't let the computer bugs bite!
  22:50:01 up 16 days, 19:41,  0 users,  load average: 1.70, 0.84, 0.53

 Linux Registered User #241685  http://counter.li.org

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


Reply via email to