Here's what I'd like to achieve:
sub first {
print "this is original first";
}
*original_first = \&first;
sub first {
print "this is first redefined";
}
original_first(); # i expect this to print "this is original first"
first() # i expect this to print "this is first redefined"
I thought that by saving the symbol for first
, I'd be able to later call the original subroutine ( under the name original_first
) and to also be able to call first
, and get the one redefined. However, if I call the original_first
, I still get the "this is first redefined". What do I have to do to make this work?