in reply to Re: subroutine call
in thread differences between ways of calling subroutines

You can also "override"1 a builtin with the &foo() syntax. You can also pass your current @_ through with it, if you leave off the parens.

sub time { print "Is on my side\n"; print &bar, "\n"; } sub bar { my ($baz) = @_; uc $baz; } &time('yes it is'); # prints 'Is on my side', a newline, followed by ' +YES IT IS'

HTH

1 OK, maybe it's not truly overriding, because of the special syntax you have to use to call it.

perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'

Replies are listed 'Best First'.
Re: Re: Re: subroutine call
by Anonymous Monk on Aug 03, 2001 at 21:43 UTC
    thanks