On 11/16/07, AndrewMcHorney <[EMAIL PROTECTED]> wrote:

> I now got my directory listing into an array of strings. I would like
> to now split up the string into a an array of strings from the
> original string. For example, I might have a string of "a b c d"
> and  I now want a 4 element array containing "a", "b", "c", 'd".
>
> I did the following but it did not work.
>
> @new_dir = @string_array[$index];

What's wrong with it? Was that just some Perl-like code that you typed
at random, or was there some reason to think that it would do what you
want?

> The new_dir array is the string from the string array.
>
> Where did I go wrong?

Do you want split?

  my @pieces = split / /, "a b c d";

I feel that I'm guessing (badly?) at what you want. Am I close? If
you're not trying to break up a string on space, what are you trying
to do?

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

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


Reply via email to