in reply to regular expressions query
my ( $meanH1, $meanH2 ); ( $meanH1, $meanH2 ) = ( $1, $2 ) if $line =~ m/^\s{9}(\S+)\s{10}(\S+)/;
You're correct to be checking the success of your matching. I don't like solutions that skip past this important step.
The preceeding example will look for (and skip past) the leading nine whitespaces. It will then capture all contiguous non-whitespace. It will then look for and skip past the next ten whitespaces. It will then capture all remaining contiguous non-whitespace. If there's anything else on the line (like a trailing newline) it will be ignored.
Dave
|
|---|