Re: Checking on logical functionality
- From: "jyetying" <yam_jyet_ying@xxxxxxxxxxx>
- Date: 21 Jun 2006 20:27:10 -0700
Thks for your answer.
if I want to compare 2 files. The content of file1 is A&B while file 2
is B&A.
How can I compare and print that the functionality is same.
My source code:
use strict;
open (MYFILE1,"file1.txt") or die "$!";
open (MYFILE2,"file2.txt") or die "$!";
my %diff;
$diff{$_} =1 while (<MYFILE2>);
while (<MYFILE1>){
print "They are not the same.","\n" unless $diff{$_};
}
close(MYFILE1);
close(MYFILE2):
usenet@xxxxxxxxxxxxxxx wrote:
jyetying wrote:
I need to write a script to show that, for example A&B is same as B&A.
Hmmmm...... A question that good deserves an answer this good:
#!/usr/bin/perl
use strict; use warnings;
sub A { 1 }
sub B { 1 }
if ( A&B == B&A ) {
print "They are the same!\n";
}
__END__
--
David Filmer (http://DavidFilmer.com)
.
- Follow-Ups:
- Re: Checking on logical functionality
- From: usenet
- Re: Checking on logical functionality
- References:
- Checking on logical functionality
- From: jyetying
- Re: Checking on logical functionality
- From: usenet
- Checking on logical functionality
- Prev by Date: Help with Hash of Arrays
- Next by Date: Asthetics in Perl
- Previous by thread: Re: Checking on logical functionality
- Next by thread: Re: Checking on logical functionality
- Index(es):
Relevant Pages
|