#!/usr/bin/perl print "Current cost of a pencil: "; chomp($cost = ); print "Inflation percentage: "; chomp($infl = ); $infl /= 100; print "Years to calculate: "; chomp($years = ); for ($i = 1; $i <= $years; $i++) { $cost += ($infl * $cost); } $cost = sprintf("%.2f",$cost); print "Cost of one pencil in $years years: \$$cost\n";