laziness, impatience, and hubris | |
PerlMonks |
Call Subroutines by Approximate Nameby davorg (Chancellor) |
on Jul 26, 2000 at 18:28 UTC ( [id://24492]=CUFP: print w/replies, xml ) | Need Help?? |
Not at all sure why anyone would want to do this - I really wrote it to see how well I understood typeglobs and AUTOLOAD :) What it does is allow you to call subroutines in your script using names that only match approximately. Currently this means that they have the same soundex value as generated by Text::Soundex. As I said above, there's really no good reason at all why you'd ever want to do this and it will make your code completely unmaintainable, but it's just a bit of fun. Here's a sample program showing how you'd use it.
In this example, &a doesn't exist so &aa gets called instead as 'a' and 'aa' both have the soundex value of 'A000' Enjoy... Update: I've uploaded this module to CPAN. You can get it at search.cpan.org/search?dist=Symbol-Approx-Sub
Back to
Cool Uses for Perl
|
|