On 08/29/2006 06:52 AM, Hien Le wrote:
[...]
# Method 2
print( "\nMethod 2\n" );
my @bar2 = split( /([a-z]{5})/, $foo );    # Captures white-spaces ?!?
[...]

The comments made by Dr. Ruud and John W. Krahn are correct. Split is returning the empty strings between delimiter segments in the original string. To zap these out, do this:

my @bar2 = grep length, split (/([a-z]{5})/, $foo);

Any substrings with a length of zero will be removed by "grep length."



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


Reply via email to