I am trying to execute the below command - but the output has some leading space introduced.
ls -lrt | wc -l
29
echo $SHELL
/bin/bash
When I run the same command on a different machine,the output is as expected.
ls -lrt | wc -l
183
echo $SHELL
/bin/bash
The leading spaces is causing my perl validation to fail
unless ( $phCountRet->{COUNT} =~ /^\d+$/ ){
...
}
I can opt to trim the leading white spaces and then do the validation,but it wont be a clean solution.
Any pointer as to what might be causing this will be a great help.
use
unless ( $phCountRet->{COUNT} =~ /^\s*\d+$/ ){
this matches also numbers with blanks in front.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With