in reply to Obtain information from a string

TIMTOWTDI, but this is probably the simplest:

if ($largestring =~ /Total Cost: (\d+)/) { $x = $1; } else { $x = 0; }
HTH.