perl -Mstrict -W -E 'say $1 if "hello 0 and 123 goodbye" =~ /(\d)+/;' 0 #### $ perl -Mstrict -W -E 'say $1 if "hello and 123 goodbye" =~ /(\d)+/;' 3 #### $ perl -Mstrict -W -E 'say $1 if "hello and 123 goodbye" =~ /(\d+)/;' 123