in reply to word with some number in between

The spec-by-example is imprecise. Does "89" fit your use of "words" or should it be excluded for lack of an alpha character?

If the latter (which is the way I read "words") you'll need slightly more complex code:

#!/usr/bin/perl use 5.016; use strict; use warnings; # 1041443 my @array=("aqw","asd8dsa","sd8sd","89","aws", "17A", "bc24", ); for my $elem (@array) { if ( $elem =~ /\d/ ) { if ( $elem !~ /[\D]/ ) { say "No non-digits in *| $elem |*"; next; } say $elem; } else { say "No numerals in *| $elem |*"; } }

OUTPUT:

No numerals in *| aqw |* asd8dsa sd8sd No non-digits in *| 89 |* No numerals in *| aws |* 17A bc24

If you didn't program your executable by toggling in binary, it wasn't really programming!