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 $/ ?
Here's my code: #!/usr/bin/perl -w use strict; $/ = ' '; # my input data is not newline separated, # rather, it appears to be separated by four spaces # per record my $mileage; while (<DATA>) { 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 In the above scenario, the input record separator is reset to four spaces as per the requirements of the data. But the regular expression's "$" is still trying to match a true end-of-line, not my new definition of what an end-of-line is (four spaces). Anyone have any ideas? Erik PS: Yes, I realize that this will cause the match to fail on the last record -- Erik Price (zombies roam) email: [EMAIL PROTECTED] jabber: [EMAIL PROTECTED] _______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm