Christiane Nerz wrote:

Oh-oh - there was a mistake - I tried chomp, not chmod..
How do I use chomp correctly? I have an array of strings, want to cut off the last \n in each line and use the rest of the line. (concatenate it to another string)
Jane


Hi all!

I like to read several rows out of two different table-files and put them successively in a new file by:

@ergebnis_alles[$#ergebnis_alles+1] = @whole_data1[$l] . $whole_data2[$m];

Anything works fine, except that I can't delete the ending newline in the lines in the first tables. So the data is put in two following lines and not successively in one line. I tried chmod, but got error-messages.


I don't see a chomp anywhere in your code. What error message did you actually get? perldoc -f chomp will give you information on it's usage.
For e.g. chomp (@strings1) will remove any trailing newlines (unless $/ has been modified) from all the elements of @strings1 array.




Whole part of code is:
foreach $el1 (@strings1) { $m=0;
foreach $el2 (@strings2) {
if ($el1 eq $el2)
[EMAIL PROTECTED] = $el1;


Take a look at the push function, perldoc -f push. The above statement can be written as push (@strings3, $el1);


@ergebnis_alles[$#ergebnis_alles+1] = @whole_data1[$l] . $whole_data2[$m];
}
else
{.....
}
$m=$m+1;
}
$l=$l+1;
}


greetings
Jane


Oh-oh - there was a mistake - Itried chomp, not chmod..





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to