Within a Perl script I need to process the following string:
426852 total
The string will always contain an integer followed by some white space and the word total. I need to strip away the string part of the variable to just leave an integer that I can compare later in the script.
What is the best way to achieve this?
Thanks
Since you don’t need the rest, just finding leading digits is enough:
^– beginning of string,\d– digit,+– one or more. Result will be in$1, captured by()