in reply to odd behaving arrays
According to your description, $array[1] has apples pears oranges in it (with tabs instead of spaces). Therefore, this line of code takes apples pears oranges and sticks it in $fruit[0]. Remember that Perl arrays start at [0]. Essentially, then, you've taken the second element of @array and stuck it into the first (and only) element of @fruit.
> my @fruit = ('apples', 'pears', 'oranges');
This takes apples and sticks it in $fruit[0], takes pears and sticks it in $fruit[1], and oranges and sticks it in $fruit[2]. This results in an array @fruit with three elements.
Does that help?
- Steve
|
|---|