#!/usr/bin/env perl use strict; use warnings; use feature 'say'; my $string = "Cat1 blah blab blah Dog0"; while ( $string =~ m/(\w+)(\d+)/g ) { say "Matched Word: $1"; say "Matched Digit: $2"; } __END__ Matched Word: Cat Matched Digit: 1 Matched Word: Dog Matched Digit: 0