in reply to getting a number from a string
If you need to get each of the numeric substrings, make it an array assignment and add the "g" modifier to the regex:$_ = "Happy Joy 002245:Dubloons 002256:hats 034523:paper clips 232344: +pants 233394"; my $first_number = ( /(\d+)/ ); print "$first_number\n";
And, the next time you say "I've tried ....", show us the actual code that you tried, so we can see why you couldn't get it to work. That makes it more educational.my @numbers = ( /(\d+)/g ); print join $/, @numbers, "";
|
|---|