|P is for Practical
Null scalars in arrayby Smaug (Pilgrim)
|on Sep 20, 2006 at 17:06 UTC
Smaug has asked for the wisdom of the Perl Monks concerning the following question:
Hello all knowing PerlMonks,
I'm having a problem which I don't quite understand. I am seaching a string and matching on certain values. Once I find the values (foo xx xx xx bar) I grab the text in between and add it to an array.
I saw some code on perlmonks today which has made my life both easier and more painful. It is:
Perfect for my needs. I just changed it to:
The problem I am having now is that sometimes there is nothing between foo and bar. There should always be 15 values but if I have two instances where there is nothing between foo and bar, @matches only contains 13 values and the first value after the null looks like "foo bar 'next value'"
Is this right? Have I gone mad? (yes) and could somebody help me get around this?