my @filtered = map {/(\d+(?:\.\d*)?)\D*$/; 0 + $1 || ''} @test; print join "\n", @filtered;