in reply to Re: Re: Re: Initialize array
in thread Initialize array

Very good answer, dragonchild++! Let me add a small remark to your remark on \s* in pattern matching regexes.

Probably what was meant was a line starting with a 'r' indented or not (assuming that we are looking at a textfile)

# was if (!($line =~ /\s*[a-qs-zA-Z]/)) # equivalent to (as noted by dragonchild) unless ($line =~ /[a-qs-zA-Z]/) # should have been IMHO unless ($line =~ /^\s*[a-qs-zA-Z]/) # which is equivalent to (with assumption 'textfile') if ($line =~ /^\s*r/)
Note the ^ indicating the beginning of the line. In that case the \s* is necessary to skip any indentation at the start of the line. The last statement is (in my view) much clearer - providing of course I guessed correctly at the intention of Myia ;-)

To sum up, if you are using an anchor (like ^, $ or \G) in your pattern then \s* might be useful in a match, otherwise it isn't.

-- Hofmator