sub foo { print( "Hello World\n" ); } BEGIN { *bar = \&foo; } foo(); bar();
The BEGIN is not necessary, but it can avoid problems.
Update: Or to demonstrate your requirements:
sub foo { print( "foo\n" ); } BEGIN { *bar = \&foo; } BEGIN { *foo = sub { print( "bar\n" ); }; } foo(); # bar bar(); # foo
In reply to Re: perl equivalent to ruby's alias
by ikegami
in thread perl equivalent to ruby's alias
by Alien
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |