Hi all,

this is a real beginner question, but I don't seem to find a good solution:

I have a single line of whitespace separated values, e.g.:

50 100 150 200 300 50

Now I want to split these values into an array using split, like:

my @array = split(/\s+/,$line);

but, unfortunately, the first value in the array is now an empty value. I can of course shift this value from the array, but I believe there must be a more elegant solution to this.

So I thought about using a positive look-behind assertion in which I look for any number preceded by a whitespace, e.g. something like:

my @array = split(/\d+(?<=\s+)/,$line);

but perl will only accept fixed-width values for look-behind assertions.

Anyone any ideas?

cheers,
Bram





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


Reply via email to