From: "JupiterHost.Net" <[EMAIL PROTECTED]> > david wrote: > > for these simple examples, it doesn't matter much and i would go > > with the first method. functionality wise, they are pretty much the > > same but there are differences that you might want to observe when > > your foo function gets more complicated. for example, the first > > method has an extra function call which means it's a tiny bit slower > > and more importantly, the stock frame will be different and caller > > return different trace for this purpose so you might want to > > consider 'goto &foo' instead. if none of those matters to > > So that woudl be: > sub foo { return "Howdy $_[0]"; } > sub bar { goto &foo; } > ?? > goto() just kind of uses the current @_ if I remeber right, correct?
Not just that. If all you wanted was to call foo with the current @_ youd write it like this: sub bar { &foo; } The goto &foo; does more. It replaces bar() by foo() in call stack. So if foo() calls caller() or croaks() it wil look like bar() was never called at all, the call stack will look like foo() was called instead. In either case ... I would use the typeglob solution: sub bar; *bar = \&foo; sub bar; is there to declare the function, so that Perl knows there is such a function. This is important if you do not use braces around parameters: bar 1, 2, 3; Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>