in reply to while loop, search & replace
You want to print out the side effect of having performed the operation, which is captured in the variable $_ that your substitution operated on. Perform the substitution on $_ and then print $_.
while (<IN>){ if (/^call started/) { s/^call.*total/Modem Line 0\/$i : /; print OUT "$_\n"; $i++; } }
Tom Moertel : Blog / Talks / CPAN / LectroTest / PXSL / Coffee / Movie Rating Decoder
|
|---|