So, must I repeat the entire subroutine in the code, changing only its name? or is there a way to alias it to another name?
There are two methods to acheive this without duplication of the code inside the subroutine. viz:
#!/usr/bin/env perl use strict; use warnings; sub hello { print "Hello $_[0]!\n"; } *hi = \&hello; sub bonjour { &hello } hello ('there'); hi ('world'); bonjour ('Alain');
It's usually cleaner and clearer just to have the one name for any given piece of functionality, however.
🦛
In reply to Re^3: Listing out the characters included in a character class
by hippo
in thread Listing out the characters included in a character class
by Polyglot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |