in reply to Aliasing a builtin?
sub len { length; } my @array = qw( fu bar baaaaz ); foreach ( @array ) { print len; }
If that's all you want, there you go. Beware of a couple of things though. First, you'll need to make sure that Perl knows what len means -- either declare the sub before, as I have done, or use a forward declaration. Second, some built-ins have special prototypes. You can use prototype to discover them. There are a couple of gotchas I always have to look up documented there.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Aliasing a builtin?
by TimToady (Parson) on Mar 11, 2003 at 17:09 UTC |