my ($pre, $suf) = split ("." , $DOMAIN);
The mistake here is that you used "" for split's first argument. split takes a regex as its first argument. There is one exception: the string ' ' (a single chr(32) character), which is special. Every other string you pass it is interpreted as a regex.
If you write it as it is interpreted, the mistake is easier to find:
It is now clear even to human beings that the . is a regex. It is a metacharacter, so you need to escape it if you want it to be matched literally:split /./, $DOMAIN
split /\./, $DOMAIN # or split /[.]/, $DOMAIN
Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }
In reply to Re: i must have forgotten how split works...
by Juerd
in thread i must have forgotten how split works...
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |