D
Daedalus
Keep in mind that I'm fresh one week years-old Perl newbie... thanks
I just need some information about what happen when :
my @string_list; #lets say that this array contain a couple of string, 3:
(the street, a book, theater)
foreach my $string (@string_list){
if ($string =~ s/(^the\b)|(^a\b)|//i){
$string_list[++$#string_lis] = $string
}
}
When I write: if ($string =~ s/(^the\b)|(^a\b)|//i)..., do I actually
replacing the string within @string_list (since $string is passed by
"foreach" from one of the string of @string_list) I'm asking cause I thought
that it would add the new strings to the array without touching what was
already there. So I would end with this list as @string_list (the street, a
book, theater, street, book).
But when try this, it overwrite and add. So it gives me ( street, book,
theater, street, book).
What am I doing wrong?
Thanks
DAE
I just need some information about what happen when :
my @string_list; #lets say that this array contain a couple of string, 3:
(the street, a book, theater)
foreach my $string (@string_list){
if ($string =~ s/(^the\b)|(^a\b)|//i){
$string_list[++$#string_lis] = $string
}
}
When I write: if ($string =~ s/(^the\b)|(^a\b)|//i)..., do I actually
replacing the string within @string_list (since $string is passed by
"foreach" from one of the string of @string_list) I'm asking cause I thought
that it would add the new strings to the array without touching what was
already there. So I would end with this list as @string_list (the street, a
book, theater, street, book).
But when try this, it overwrite and add. So it gives me ( street, book,
theater, street, book).
What am I doing wrong?
Thanks
DAE