in reply to Re: Re: aliasing subs
in thread aliasing subs

The base sub has to return either $a or $b, $pathname or $filename

Err... no.

sub do_the_match { my $dir = shift; my ($path, $name) = ($dir =~ /(.*)\/([^\/]*)$/); return ($path, $name); }
--
3dan

Replies are listed 'Best First'.
Re: Re: Re: Re: aliasing subs
by december (Pilgrim) on May 06, 2003 at 15:30 UTC

    Yes, I'm sorry. I meant *must* return, by my own specification. I know I can return a list, but I think that would make using the function a bit harder, since I usually only need either the path or the file.

    That's what complicates the matter; the output depends completely on what name was used to call the function, so if I can't find that out, my implementation is quite useless.

    It's something that I would like to see implemented in a new version of Perl, though. I think it would be handy in some cases... More clear to read than anonymous subs.