Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Re: aliasing subs

by edan (Curate)
on May 06, 2003 at 12:27 UTC ( [id://255858]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://255858]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-25 08:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found