D
David Morel
Hi all,
I am having a problem with the split function.
Here is my code:
$_ = "123 a 456 b 789 c";
my @words = split /[^a-z]+/, $_;
print $words[0], $words[1], $words[2];
I want the output to be: abc
However, the actual output of this code is: ab
($words[0] is equal to "" not "a").
What am I doing wrong? Why isn't the output abc?
I am having a problem with the split function.
Here is my code:
$_ = "123 a 456 b 789 c";
my @words = split /[^a-z]+/, $_;
print $words[0], $words[1], $words[2];
I want the output to be: abc
However, the actual output of this code is: ab
($words[0] is equal to "" not "a").
What am I doing wrong? Why isn't the output abc?