http://qs321.pair.com?node_id=11137514


in reply to Problem with regexp to match

In fact, you're interested in digits after a minus. Use the global matching to get all the matches:

#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; for my $string ('01/LC-13/E10GbE-1,01/LC-14/E10GbE-1', '01/LC-13/E10GbE-1' ) { my @numbers = $string =~ /-([0-9]+)/g; say "@numbers"; }
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]