in reply to i must have forgotten how split works...

Aaah - - - regexes in Perl can be both a Boon and a Bane!
You are splitting on "." - the regex for any character - - so all you are going to get back is what is between each character - - - nothing!
So split on "\."
You haven't forgotten how Split works - - just overlooked how regexes work! :)
/Gridlock a.k.a. Debashis "Codito Ergo Sum"
  • Comment on Re: i must have forgotten how split works...

Replies are listed 'Best First'.
Re: Re: i must have forgotten how split works...
by bart (Canon) on Mar 10, 2004 at 09:09 UTC
    So a split on "\."
    No... "\." is still ".". The constructed string should contain a backslash, so you have to write either "\\." or '\.' (or '\\.'). Constructing a regexp in a string is a bit of a pain. That's one of the reasons why qr was invented: qr/\./ will do the right thing, and still return something that can be treated like a string.

    Safer still is to stop playing games and just use the regexp, and write

    my ($pre, $suf) = split /\./, $DOMAIN;