in reply to In place edit and printf
You are not giving printf a value for the %s token. Either pass in $' as the next arg, or replace %s in the picture with $'. Also, this may have been a retype error, but you probably don't want the $ at the end of your regex since there is more text to follow the digits.
while (<>) { m/^(\w+)\s+(\d+)(.*)$/ or die; # You should # always check a regex before # using $1, etc. printf "%s %d %s", $1, (exists $disk{$1} ? 0 : $2+$partition), $3 +; }
Updated: Removed $1 from the picture per suggestion below.
Ted Young
($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: In place edit and printf
by ikegami (Patriarch) on Dec 09, 2005 at 16:47 UTC | |
by TedYoung (Deacon) on Dec 09, 2005 at 17:01 UTC | |
|
Re^2: In place edit and printf
by Anonymous Monk on Dec 12, 2005 at 09:06 UTC |