in reply to getting a number from a string
And the output -use strict; use warnings; use Data::Dumper; my $str = 'Happy Joy 002245:Dubloons 002256:hats 034523:paper clips 23 +2344:pants 233394'; my %capture = $str =~ /(\D*?)\s+(\d+):?/g; print Dumper(\%capture);
$VAR1 = { 'pants' => '233394', 'hats' => '034523', 'Happy Joy' => '002245', 'Dubloons' => '002256', 'paper clips' => '232344' };
|
|---|