Edward Wijaya wrote:
On Tue, 15 Mar 2005 02:29:06 +0800, John W. Krahn <[EMAIL PROTECTED]> wrote:

Edward Wijaya wrote:

[snip]

Here is one way to do it:

my %files;
for ( @ARGV ) {
     next unless /(.+)\.(?:fa|rs)$/;
     push @{ $files{ $1 } }, $_;
     }

for my $base ( keys %files ) {
     if ( @{ $files{ $base } } != 2 ) {
         warn "Error: only one file '@{$files{$base}}'.\n";
         next;
         }
     die "Cannot open files '@{$files{$base}}'.\n"
         unless open F, '<', $files{ $base }[ 0 ]
            and open G, '<', $files{ $base }[ 1 ];
     print "$base\n>\n";
     while ( my $f = <F> and my $g = <G> ) {  # LINE 32
         print $f + $g, "\n";

## BTW I can just do my other funky stuff here right?

Right.

         }
     }


I encounter this error:
"
Value of <HANDLE> construct can be "0"; test with defined() at thecode.pl line 32.
thecode.pl syntax OK "

That warning can be fixed like this:

    while ( defined( my $f = <F> ) and defined( my $g = <G> ) ) {
        print $f + $g, "\n";




John -- use Perl; program fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to