* Erik Price <[EMAIL PROTECTED]> [2002-09-23 17:30]:
> Anyone know of a way to get a regular expression to respect the input
> record separator ( $/ ), so that "$" represents the end of a line as
> defined by $/ ?
I'd do it a little differently:
local $/;
my $mileage;
my @milage = split / /, <DATA>; # <-- the string with your data
for (@milage) {
if (m/(\d+\.\d{1,2})$/) {
$mileage += $1;
}
}
print "$mileage total miles\n";
__DATA__
1. Start on MILL ST 0.0 2. Bear Left on MAIN ST 3.2 3.
Continue on KENDALL RD 0.3 4. Take the US-3 SOUTH ramp towards
BOSTON/LOWELL 0.4 5. Merge on US-3 SOUTH 18.7
This gives 22.6, which is what bc tells me.
(darren)
--
It's not that things are getting worse, it's just that news
reporting is getting better.
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm