perl dot escaping issue

Hello,

I'm trying to figure out why this perl command does not work.
I want to split a string on dot delimiter.
If I try with colon the result is fine:

> echo -n "hello:world" | perl -F/:/ -ane 'print "$F[1]\n"'
>world

As expected I get the good result, but by typing:

> echo -n "hello.world" | perl -F/./ -ane 'print "$F[1]\n"'
> (nothing)

I get an empty line. I tried by escaping the dot by using :

> echo -n "hello.world" | perl -F/\./ -ane 'print "$F[1]\n"'
> (nothing)

but I get always the same result. It looks like an escaping problem. Do you have any tip?

Thanks in advance

try this..:slight_smile:

echo -n "hello.world" | perl -F/[.]/ -ane 'print "$F[1]\n"'

Cool thanks! it works

A more common usage is:

echo -n "hello.world" | perl -F'\.' -ane 'print "$F[1]\n"'