[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Setting a variable to a string match



I'm trying to set a scalar variable to equal a string match.  For example,
I want to extract a dollar amount (e.g., $23.99) from a line.  Here's what
I've come up with so far:

	$line =~ /\$(\d{0,}.\d\d)/; # apply a match to a line, using back
reference parens
	$price = $1; # recall the last back reference
	print $price . "\n";

Is this the most efficient way to accomplish this task?  Seems like there
should be a more efficient way.

Thanks,

Darryl Tang





_________________________________________________________

Yoshi's Franchise Corporation
of America, Inc.

http://www.yoshisonline.com


-end message-





===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org