Regular expression to split on .

P

PC

Example:

my $string = abc\def.ghi\jkl

split( ".", $string) returns an empty list.

Any idea what I am doing wrong?
 
J

Jürgen Exner

PC said:
Example:
my $string = abc\def.ghi\jkl
split( ".", $string) returns an empty list.

Any idea what I am doing wrong?

Well, I would guess yes because apparently you are not happy with the
result.
However there is no way of saying what you are doing wrong because you
didn't tell us what you expect this code to do in the first place.

jue
 
P

PC

Jürgen Exner said:
Well, I would guess yes because apparently you are not happy with the
result.
However there is no way of saying what you are doing wrong because you
didn't tell us what you expect this code to do in the first place.

jue

The correct answer was split(/\./, $string)

Thanks.
 
A

Alex I. Varyanick

2005-04-13 said:
Example:

my $string = abc\def.ghi\jkl

split( ".", $string) returns an empty list.

Any idea what I am doing wrong?

try this
perl -le '$a="qwe.rew.sa.ds"; @b=split /\./,$a; print "@b";'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top