From: Tim McGeary <mailto:[EMAIL PROTECTED]> wrote:
: I don't get any errors either with the sample.pl and : sample files. So I wonder if the data is bad in the : middle of the file. I guess that has to be it since : I get the errors with sample.pl and the full data file. : : What is the best way to redirect that bad data to a : different file or array? The @fund_array array doesn't contain information about the raw data used to create it. For that reason, it would be difficult to report the raw data while manipulating @fund_array without changing its structure. Here's a rewrite of sample.pl. It does the same thing you were doing without the arrays. It is not exactly the same output. I left the trailing pipe off the end of each record. It is uncommon for it to be there. You should be able to find the line number of sample.txt from the uninitialized error you are receiving. I unsuccessfully tried to reproduce your error by corrupting the data myself. Let us know if you find the error in your data. HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 #!/s/sirsi/Unicorn/Bin/perl use strict; use warnings; use Time::Local; use POSIX 'strftime'; use constant CAT_VALUE => 10_000_000; use constant DATE => strftime( '%Y-%m-%d', localtime() ); use constant LCD => 0; my %codes; my $file = 'codes.txt'; open FH, $file or die qq(Cannot open "$file": $!); while (<FH>) { chomp; my( $code, $id ) = split /\|/; $codes{ $code } = $id; } close FH; $file = 'ej.title'; open CODED, "> $file" or die qq(Cannot open "$file": $!); $file = 'etexts.data'; open ETEXT, "> $file" or die qq(Cannot open "$file": $!); $file = 'disEtexts.data'; open DIS_ETEXT, "> $file" or die qq(Cannot open "$file": $!); $file = 'reject.title'; open REJECT, "> $file" or die qq(Cannot open "$file": $!); $file = 'sample.txt'; open FH, $file or die qq(Cannot open "$file": $!); my $prev_key = 0; my $title_count = 0; my $code = ''; while ( <FH> ) { my( $key, $title, $data ) = split /\|/; if ( $prev_key != $key ) { $title_count = 0; if ( exists $codes{ $data } ) { $title_count = 1; $prev_key = $key; $code = $data; } else { print REJECT "$key|$title\n"; } } else { $title = "$title(archive)" if $data =~ /jstor|prola/; my $cat_key = $title_count * CAT_VALUE + $key; my $ezproxy = 'http://foo'; print CODED join( '|', $cat_key, $title, $ezproxy . $data, $code, ), "\n"; print ETEXT join( "\t", $cat_key, $title, $ezproxy . $data, # url $ezproxy . $data, # description $code, DATE, LCD, ), "\n"; print DIS_ETEXT join( "\t", $codes{ $code }, $cat_key, ), "\n"; $title_count++; } } close FH; close CODED; close ETEXT; close DIS_ETEXT; close REJECT; __END__ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>