I think I've missed something, even after poring over the archives for
some hours looking for the answer. How does one write defaulting
subroutines a la builtins like print() and chomp()? Assume the code:
for <> {
printRec;
}
printRec "Done!";
sub printRec {
chomp;
print ":$_:\n";
}
Assuming the input file "1\n2\n3\n", I want to end up with:
:1:
:2:
:3:
:Done!:
I assume I'm missing something in the "sub printRec {" line. But what?
(I also assume, perhaps incorrectly, that I won't have to resort to
anything so crass as checking whether my first parameter is defined...)
--
Trey Harris
Secretary and Executive
SAGE -- The System Administrators Guild (www.sage.org)
Opinions above are not necessarily those of SAGE.