Paul Lalli wrote:
On Oct 5, 9:09 am, [EMAIL PROTECTED] (Robert Hicks) wrote:The scenario: I have a file with ship id numbers. It gets updated several times a day (by database query) and I want to find all the "new_ships" that have been added to it. sub incremental_update { print "Doing incremental update.\n"; open $FH, '+<', $ships_file or croak "Cannot open $ships_file!\n"; # Get all the ships in it my @ships = do { local $/; <$FH> };Are you aware each element of @ships has a newline attached? Is that what you want?
Not quite! That puts the entire file's contents into one element of @ships. Try this: open my $fh, '<', $ships_file or croak "Cannot open $ships_file: $!"; chomp (my @ships = <$fh>); close $fh; HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
