Unexpected leading spaces while using wc -l command Unexpected leading spaces while using wc -l command unix unix

Unexpected leading spaces while using wc -l command


use

unless ( $phCountRet->{COUNT} =~ /^\s*\d+$/ ){

this matches also numbers with blanks in front.


As I noted in WC on OSX - Return includes spaces, this is an implementation detail, which is not explicit in the POSIX standard (so it depends on the implementer's preference to align columns—or not).