in reply to word with some number in between
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
|
|---|