Re: [exim] String expansion: reversing a domain name?

Pàgina inicial
Delete this message
Reply to this message
Autor: Lanny Jason Godsey
Data:  
A: Marc Sherman, 'Exim-users'
CC: 
Assumpte: Re: [exim] String expansion: reversing a domain name?
If you embed perl (I do), then this will work for you.

sub flipit {
    my @parts, @new;
    @parts = split("\\.", shift);
    while (@parts) {
        push(@new, pop(@parts));
    }
    return join ".", @new;
}


to test, stick it in a file and use

print flipit("www.i.am.here.com"), "\n";

--- Marc Sherman <msherman@???> wrote:

> Here's a brain-teaser for the string expansion gurus on the list.
>
> Is it possible to reverse a domain name with Exim's string expansion
> operators?
>
> EG: given input "foo.bar.baz.com", output "com.baz.bar.foo".
>
> Thanks,
> - Marc
>
> --
> ## List details at http://www.exim.org/mailman/listinfo/exim-users
> ## Exim details at http://www.exim.org/
> ## Please use the Wiki with this list - http://www.exim.org/eximwiki/
>