a doubt

2003-12-15 Thread Ajey
Hi,
How can i catch the difference in 2 files on a perl stmt?
I want to do somethign like,
if (there is some diff in 2 files)
do something1
else
do something2
Both files are simple text files

TIA
-Ajey


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: a doubt

2003-12-15 Thread John W. Krahn
Ajey wrote:
> 
> Hi,

Hello,

> How can i catch the difference in 2 files on a perl stmt?
> I want to do somethign like,
> if (there is some diff in 2 files)
> do something1
> else
> do something2
> Both files are simple text files

use File::Compare;

if ( compare( 'file1', 'file2' ) == 0 ) {
print "They are the same\n";
}
else {
# do something else
}


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: a doubt

2003-12-15 Thread Ajey
Too good. thanks John.

On Mon, 15 Dec 2003, John W. Krahn wrote:

> Ajey wrote:
> > 
> > Hi,
> 
> Hello,
> 
> > How can i catch the difference in 2 files on a perl stmt?
> > I want to do somethign like,
> > if (there is some diff in 2 files)
> > do something1
> > else
> > do something2
> > Both files are simple text files
> 
> use File::Compare;
> 
> if ( compare( 'file1', 'file2' ) == 0 ) {
> print "They are the same\n";
> }
> else {
> # do something else
> }
> 
> 
> John
> -- 
> use Perl;
> program
> fulfillment
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
> 
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




A Doubt on Regular Expression

2003-05-31 Thread Hari Krishnaan
Hi everyone,
Can anyone tell me what the following piece of code does :
 
my $cur_dir = cwd ();
if ($cur_dir =~ m, ^/.*/ (.*)/xyz,) {
}
 
Thanks,
hari



-
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

RE: A Doubt on Regular Expression

2003-05-31 Thread Sethi, Pradeep
seems, it matches any path with 2 sub dirs, ending with xyz and populates $1 with the 
second dir

for instance

if $cur_dir = "/cgi-bin/dev/xyz" 

then $1 is set to "dev"


-Original Message-
From: Hari Krishnaan [mailto:[EMAIL PROTECTED]
Sent: Friday, May 30, 2003 9:27 AM
To: [EMAIL PROTECTED]
Subject: A Doubt on Regular Expression


Hi everyone,
Can anyone tell me what the following piece of code does :
 
my $cur_dir = cwd ();
if ($cur_dir =~ m, ^/.*/ (.*)/xyz,) {
}
 
Thanks,
hari



-
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]