The problem with your print '\n';
was not that it wasn't printf()
but that it used single quotes, where no interpolation was done - i.e. Perl interpreted the slash-n literally, and printed out a slash-n to your browser. If you were to use print "\n";
it would work as you wanted.
Generally speaking printf is used only if you want to do some kind of formatting, for instance:
Will pad the variable out to have a width of 4 characters, and it will be preceded with 0's, i.e.
$count = 4;
# prints out 0004
$count = 3489;
#prints out 3489
Hope that helps.