Strings vs Arrays




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

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.

Thanks,
Mike

--

Multitasking: Screwing up several things at once...
01:45:01 up 15 days, 22:36, 0 users, load average: 0.15, 0.24, 0.28

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



Relevant Pages

  • push() to @array[$count] gives me error, is there any other way?
    ... {# creation of array names array0, ... Type of arg 1 to push must be array ... My plan is to push every string from ARGV to array1, ...
    (comp.unix.shell)
  • Re: Strings vs Arrays
    ... To push something to an array: ... To push something onto a scalar: ... The better method depends entirely on what you intend to do with the ... It is also very easy to both split a string ...
    (perl.beginners)
  • Re: MSComm Newby Question
    ... Should I parse it out as it comes into the buffer one character ... The simple way is to concatenate data in the OnComm event. ... up the string buffer that you use to concatenated data, ...
    (microsoft.public.vb.controls)
  • Semicolon v ampersand as concatenation delimiter with debug.print
    ... The ampersand is a regular operator that will concatenate data of ... various types into a string: ... The semicolon appears to be part of a special syntax used with ...
    (microsoft.public.vb.general.discussion)
  • Re: Strings vs Arrays
    ... M. Lewis wrote: ... I would assume that we could concatenate data on to a string as well ... Is a hammer 'better' than a screwdriver? ...
    (perl.beginners)