Also, is there a reason you don't use return in sub get_name? I know you don't have to, but it makes it _much_ easier to detect bugs if you insert new lines at the end of the sub (or, someone else who isn't paying enough attention to your code does.) I'd generally consider always saying 'return' when you want to return a value as one of those habits of highly successful perl programmers.
This is by large a matter of personal taste/preference. I'm not striving for "extreme" conciseness, as that would be "golf" and doesn't make for clarity, but the "Right(TM)" degree of conciseness, which includes avoiding redundant or unnecessary syntax, does make for it. In particular the last line of a sub is already visually distinct enough and I generally consider never saying return unless I want to explicitly return prematurely.
It's not exactly the same thing but the advice of always returning reminds me of the cargo-culted habit of always including an unnecessary
exit 0;
line at the end of one's scripts.
In reply to Re^2: Can i make this more efficient with a special variable?
by blazar
in thread Can i make this more efficient with a special variable?
by nmerriweather
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |