use warnings; use strict; my $_sensor_type = 'I2600*&^_A8699()^%#@C9800&*%A96'; my @types = $_sensor_type =~ /[a-z]+([0-9]+)/ig; #parens aren't needed here but to make list clear, #could have been: #my @types = ($_sensor_type =~ /[a-z]+([0-9]+)/ig); print join("\n",@types),"\n"; __END__ ## prints ### 2600 8699 9800 96 #### my $_sensor_type = 'I2600*&^_A8699()^%#@C9800&*%A96'; my $type = ($_sensor_type =~ /[a-z]+([0-9]+)/i)[0]; print "$type\n"; #prints 2600 #so what happens if the match and consequent slice fails? $type ||= "some default"; #or check for undef