my $string = "foo bar baz blah Total Cost: 480 foo foo foo"; my ($cost) = $string =~ /Total\s+Cost:\s*(\d+)/; $cost ||= 0;
In reply to Re: Obtain information from a string
by thelenm
in thread Obtain information from a string
by Baz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |