
BillKSmith
Veteran
Oct 3, 2011, 1:03 PM
Post #2 of 2
(588 views)
|
|
Re: [joshuamhenrich] Pattern Matching to first character
[In reply to]
|
Can't Post
|
|
Use a regular expression to remove whitespace.
use strict; use warnings; my $tax_rate = .0625; while (my $cost = <DATA>) { chomp $cost; $cost =~ s/^\s*//; my $tax = $cost * $tax_rate; my $total_cost = $cost + $tax; print $cost, ' ', $total_cost, "\n"; } __END__ 1.74 21.56 100000.00 3983.12 Good Luck, Bill
|