in reply to Re: Re: Re: Re: going loopy
in thread going loopy

I wish to be able to access each element individually and thought that using 'join' followed by 'split' would allow me to do this;
Erm, I think you need to read perldata, which should inform you about how arrays work in perl.

What you're doing with your code is joining an array on an empty string, which will create one string comprised of the elements of the array joined together. Then you're splitting on any whitespace1 in that string, which won't work since your array won't contain any whitespace, then split returns the original string which is then assigned to $uniques_slopes[0].

As you can guess, this does not do what you want at all. To access individual array elements, you just access them using the square bracket syntax like so

## see. perlop for more info on qw// my @array = qw/ one two three four five /; ## create a range from 0 to the index of the last element in @array for my $i (0 .. $#array) { ## acccessing element at $i using square bracket syntax print $array[$i]; } ## this is a more idiomatic approach print for @array;
Thanks for the info, it has made helping much easier, and if you plan on sticking around then I recommend joining up :)
HTH

_________
broquaint

1 see. the split docs on why you can just a ' ' as the delimiter for this special case