After some further investigation, I've discovered this throughout the I/O section. The book says that in the following code, the first "!finout.good()" checks to make sure there were no errors when reading the file. The second one is to make sure there were no errors when the file is closed...
The following code works as expected. It reads data from the input file into the array and displays the array. The problem is that my error checking mechanism "if(!fin.good())" is executing and I'm not sure why...
The file I'm reading from is a simple plain text file (formatted data) with:
5...
I've been trying to replace a ":" with "X" using tr. With the code:
if ( index( $test_string, ":" ) == -1) {
$test_string =~ tr/:/X/;
}
I'm sort of new to perl, I was thinking that maybe it was a special character, so I tried to using "\", but that didn't work. Any ideas?
Thanks.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.