FAQ

Ryan wrote:
given:

sub really_long_function_name_i_do_not_like_to_type {return 'data';}

can I create some kind of alias, like real_long_func ?

how?
Using a typeglob copy:

$ perl -le'
sub really_long_function_name_i_do_not_like_to_type { return q/data/ }
print really_long_function_name_i_do_not_like_to_type();
*real_long_func = *really_long_function_name_i_do_not_like_to_type;
print real_long_func();
'
data
data


Or use goto:

$ perl -le'
sub really_long_function_name_i_do_not_like_to_type { return q/data/ }
print really_long_function_name_i_do_not_like_to_type();
sub real_long_func { goto &really_long_function_name_i_do_not_like_to_type }
print real_long_func();
'
data
data



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 6 | next ›
Discussion Overview
groupbeginners @
categoriesperl
postedAug 27, '08 at 6:32p
activeAug 27, '08 at 8:40p
posts6
users5
websiteperl.org

People

Translate

site design / logo © 2022 Grokbase