Using a recursive function will always eat up more memory as you go, especially since your functions never stop or return anything. I suppose out your two examples, the second one is better, just because it's not recursive. Not that you asked, but I think you could write it more clearly and elegantly like this:
#!/usr/bin/perl -w
use strict;
while ( <STDIN> ) {
chomp();
if ( /^\d+$/ ) {
print "You entered: $_\n";
}
else {
print "Not a number!\n";
}
}
"We're experiencing some Godzilla-related turbulence..."