RE: Getting the dir structure

2004-12-02 Thread Mallik
u can look at the below code.

use File::Basename;

while(){
my $line=$_;
chomp;
my $dir = dirname($line);
print "$dir\n";
}


-Original Message-
From: Owen Cook [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 02, 2004 2:44 PM
To: perl beginners
Subject: Re: Getting the dir structure




On Thu, 2 Dec 2004, Nilay   Puri, Noida wrote:

> 
> I have a file with thousands of line  like :
> 
> /abc/def/ijk/test.txt
> 
> /pqr/lmn/test1.t
> 
>  
> 
> I want to get the directory where the files test.txt and test1.txt are
> lying.


Try something like this

-

#!/usr/bin/perl -w

use strict;

while(){
my $line=$_;
chomp;
if(($line=~/test\.txt/) or ($line=~/test1\.txt/)){print "$`\n"}
}

__DATA__
/abc/def/ijk/test.txt
/pqr/lmn/test1.txt




and see if it helps



Owen

ps you could probably get rid of the chomp.


-- 
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]
 




Deleting the records from a table

2004-12-13 Thread Mallik
Hi Friends,

I need a help from you in implementation of purging functionality.
I am given a hash of table(s), each having millions of records. i need to
delete those records keeping latest 5 days records in the tables.

I know the delete query like: delete from $tableName where adddtm < today ?
$numDays ; where $numDays is the variable having number of days latest data
to be retained. if i give the direct query like above it takes a lot of time
to delete records from that set of tables.

Do you have any idea to implement this purging that can be done in time for
any number of tables containing millions of records in a loop. i need to
implement this in perl, with DBI-informix interface.

Thanks in advance,
Mallik.


RE: regexp for a blank line

2004-12-13 Thread Mallik
Its simple.

next if ($line =~ /^\s*$/);

Mallik.

-Original Message-
From: Christopher Spears [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 14, 2004 11:14 AM
To: [EMAIL PROTECTED]
Subject: regexp for a blank line


I have to write a script that processes text in a
file.  The text includes lots of blank lines.  How can
I tell Perl to skip the lines?  I thought maybe
something like:

next if ($line =~ /\s+/);

However, what if the line simply happens to have more
than one whitespace.  Even a sentence has whitespace
between the words!  Or maybe the line is idented!





=
"I'm the last person to pretend that I'm a radio.  I'd rather go out and be
a color television set."
-David Bowie

"Who dares wins"
-British military motto

"The freak is the norm." - "The Infernal Desire Machines of Dr. Hoffman" by
Angela Carter

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

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



RE: Deleting the records from a table

2004-12-14 Thread Mallik
Hi Jose,

Thanks for your prompt reply.

I too thought of same solution, but we don't want to delete the original
table. Any other solution is greatly appreciated.

Thanks & Regards,
Mallik.

-Original Message-
From: José Pedro Silva Pinto [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 14, 2004 5:02 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Deleting the records from a table


Hi,

It songs a funny solutions but...

Create a TEMP table and insert latest 5 days data

After delete the table and rename temp table


José Pinto


-Original Message-----
From: Mallik [mailto:[EMAIL PROTECTED]
Sent: terça-feira, 14 de Dezembro de 2004 11:31
To: [EMAIL PROTECTED]
Subject: Deleting the records from a table


Hi Friends,

I need a help from you in implementation of purging functionality.
I am given a hash of table(s), each having millions of records. i need to
delete those records keeping latest 5 days records in the tables.

I know the delete query like: delete from $tableName where adddtm < today ?
$numDays ; where $numDays is the variable having number of days latest data
to be retained. if i give the direct query like above it takes a lot of time
to delete records from that set of tables.

Do you have any idea to implement this purging that can be done in time for
any number of tables containing millions of records in a loop. i need to
implement this in perl, with DBI-informix interface.

Thanks in advance,
Mallik.

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

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



NCR to Shift JIS

2004-12-21 Thread Mallik
Hi all,

I have a requirement whrein i need to convert the NCR values
representing Japanese characters back into the Shift_JIS equivalent
characters. Is there a Perl code/module available for the same.

Thanks in advance,

Mallik.

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




NCR to Shift JIS

2004-12-22 Thread Mallik
Hi all,

I have a requirement whrein i need to convert the NCR values
representing Japanese characters back into the Shift_JIS equivalent
characters. Is there a Perl code/module available for the same.

Thanks in advance,

Mallik.

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




Strange Output

2004-12-23 Thread Mallik
Hi Friends,

I have the below code.

#!/usr/local/perl5.6.1/bin/perl

print STDOUT "===Before system
call===\n\n";
system("ls -al");
print STDOUT "\n\n===After System
Call\n\n";

When I execute the code from command prompt, the output is,


===Before system
call===

total 8
drwxr-xr-x   2 mkodiche cisco 96 Dec 23 21:54 .
drwxr-xr-x   4 mkodiche cisco   1024 Dec 23 19:36 ..
-rw-r--r--   1 mkodiche cisco465 Dec 23 22:00 a.txt
-rwxrwxr-x   1 mkodiche cisco279 Dec 23 22:00 background.pl
-rwxrwxr-x   1 mkodiche cisco 92 Dec 23 21:53 loop.pl


===After System Call


But, when I redirect the output to a file, the contents of the file are

total 6
drwxr-xr-x   2 mkodiche cisco 96 Dec 23 21:54 .
drwxr-xr-x   4 mkodiche cisco   1024 Dec 23 19:36 ..
-rw-r--r--   1 mkodiche cisco  0 Dec 23 22:34 a.txt
-rwxrwxr-x   1 mkodiche cisco279 Dec 23 22:00 background.pl
-rwxrwxr-x   1 mkodiche cisco 92 Dec 23 21:53 loop.pl
===Before system
call===

===After System Call

As seen above, the system call output is displayed first and then the
print statement.

Why it is behaving strangely? Any idea?

Thanks is advance,

Mallik.

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




How to find the Index of an element in array?

2005-01-26 Thread Mallik
I need to find the index of a particular element in array. 

For eg.,
@arr = ('abc', 'xyz', 'mno','pqr','stu','sdfd');

I want to find the index of the element 'pqr' which is 4.

Any function/code to achieve this.

Thanks in advance,
Mallik.

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




RE: How to find the Index of an element in array?

2005-01-26 Thread Mallik
Hi,

Thanks for ur reply.

Is there any function instead of looping thru entire array.

Mallik.


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 27, 2005 1:06 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: beginners@perl.org
Subject: RE: How to find the Index of an element in array?



Hi Mallik
You can use regular expression

-
$i=0;
 foreach $temp (@arr)
  {
if ( $temp eq 'pqr' )
 {
   print "index is == $i \n";
   last;
  }
$i++;
   }
-
I hope this will work ,but ur desired index is 3 not 4.

Mallik ..

Deserve before you desire









-Original Message-
From: Mallik [mailto:[EMAIL PROTECTED]

Sent: Thursday, January 27, 2005 12:56 PM
To: Perl-Trolls
Cc: beginners@perl.org
Subject: How to find the Index of an element in array?


I need to find the index of a particular element in array.


For eg.,
@arr = ('abc', 'xyz', 'mno','pqr','stu','sdfd');

I want to find the index of the element 'pqr' which is 4.

Any function/code to achieve this.

Thanks in advance,
Mallik.

--

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





Confidentiality Notice


The information contained in this electronic message and any attachments
to this message are intended
for the exclusive use of the addressee(s) and may contain confidential
or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or
[EMAIL PROTECTED] immediately
and destroy all copies of this message and any attachments.

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

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




Problem in reading cookies

2005-01-28 Thread Mallik
Hi All,

I have an perl script that reads cookies. In one system it is able to
read the cookies properly. But the same is not working in another
system. Browsers and their versions are same in both systems. I even set
the browser properties same in both the systems.

Then I printed the environment variables in that script. The variable
HTTP_COOKIE is printed in first system but not in the other system
(where it is not able to read the cookies).

What could be the reason for this? Any help in this is greatly
appreciated.

Thanks & Regards,
Mallik.

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




Problem in reading cookies

2005-01-31 Thread Mallik
Hi All,

I have an perl script that reads cookies. In one system it is able to
read the cookies properly. But the same is not working in another
system. Browsers and their versions are same in both systems. I even set
the browser properties same in both the systems.

Then I printed the environment variables in that script. The variable
HTTP_COOKIE is printed in first system but not in the other system
(where it is not able to read the cookies).

What could be the reason for this? Any help in this is greatly
appreciated.

Thanks & Regards,
Mallik.

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




RE: Problem in reading cookies

2005-02-02 Thread Mallik
Hi Marcello,

Here is the detailed info.

We have two applications. One applications sets the value of the cookie
and the 2nd application reads that cookie's value. When I execute the
first application in 2 systems, the cookie is being set in first system,
but not in the 2nd system. That's why the 2nd application is not able to
read the cookies in the 2nd system. The browser is IE 6.0 and the
settings are same in both the systems. We are not able to trace the
problem. Any help in this regard is greatly appreciated.

Hope I have given required information.

Thanks,
Mallik.

-Original Message-
From: Marcello [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 02, 2005 1:51 PM
To: Mallik
Cc: beginners@perl.org
Subject: Re: Problem in reading cookies


Mallik ha scritto:
> Hi All,
> 
> I have an perl script that reads cookies. In one system it is able to
> read the cookies properly. But the same is not working in another
> system. Browsers and their versions are same in both systems. I even
set
> the browser properties same in both the systems.

You mean "accept cookies" and such ?

> 
> Then I printed the environment variables in that script. The variable
> HTTP_COOKIE is printed in first system but not in the other system
> (where it is not able to read the cookies).
> 
> What could be the reason for this? Any help in this is greatly
> appreciated.
> 
> Thanks & Regards,
> Mallik.
> 

You should supply more information to help somebody help you.

Marcello

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




RE: Perl waits for while to finish before printing if on the sameline,why?(countdown prog)

2005-02-20 Thread Mallik
Still the result is same.

-Original Message-
From: Manav Mathur [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 21, 2005 1:11 PM
To: Mark Jayson Alvarez; beginners@perl.org
Subject: RE: Perl waits for while to finish before printing if on the
sameline,why?(countdown prog)




Try this

my $countdown = 5;
local $|=1 ;
while ($countdown > 0){
print "\.";
sleep 1;
$countdown--;
}
print "Kaboom!!"
-Original Message-
From: Mark Jayson Alvarez [mailto:[EMAIL PROTECTED]
Sent: Monday, February 21, 2005 9:39 AM
To: beginners@perl.org
Subject: Perl waits for while to finish before printing if on the same
line,why?(countdown prog)


Hi,
  I'm new to perl and i'm trying to create a simple
program that will act like a time bomb but will print
a dot(something like a progress bar every second until
the specified time arrives. Here's my code.

my $countdown = 5;
while ($countdown > 0){
print "\.";
sleep 1;
$countdown--;
}
print "Kaboom!!"

And the result..
after waiting for 5 seconds, it displayed this line at
once:

.Kaboom!!


Why does this happens with a while loop? I told it to
print a single dot every 1 second. Do you know another
way of making my progress bar program that display a
single dot every one second on the same line until it
reaches a given time?

Thank you!









__ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250

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



*
Disclaimer:

The contents of this E-mail (including the contents of the enclosure(s)
or attachment(s) if any) are privileged and confidential material of MBT
and should not be disclosed to, used by or copied in any manner by
anyone other than the intended addressee(s).   In case you are not the
desired addressee, you should delete this message and/or re-direct it to
the sender.  The views expressed in this E-mail message (including the
enclosure(s) or attachment(s) if any) are those of the individual
sender, except where the sender expressly, and with authority, states
them to be the views of MBT.

This e-mail message including attachment/(s), if any, is believed to be
free of any virus.  However, it is the responsibility of the recipient
to ensure that it is virus free and MBT is not responsible for any loss
or damage arising in any way from its use

*

-- 
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]
 




RE: Perl waits for while to finish before printing if onthesameline,why?(countdown prog)

2005-02-20 Thread Mallik
Hi Manav,

Same code is working as expected in Unix OS, but not in Windows.

Thanks,
Mallik.

-Original Message-
From: Manav Mathur [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 21, 2005 1:17 PM
To: Mallik; beginners@perl.org
Cc: 'Mark Jayson Alvarez'
Subject: RE: Perl waits for while to finish before printing if
onthesameline,why?(countdown prog)



Are you using it as a command line tool or as CGI etc??

Manav

-Original Message-----
From: Mallik [mailto:[EMAIL PROTECTED]
Sent: Monday, February 21, 2005 1:12 PM
To: beginners@perl.org
Cc: 'Manav Mathur'; 'Mark Jayson Alvarez'
Subject: RE: Perl waits for while to finish before printing if on
thesameline,why?(countdown prog)


Still the result is same.

-Original Message-
From: Manav Mathur [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 21, 2005 1:11 PM
To: Mark Jayson Alvarez; beginners@perl.org
Subject: RE: Perl waits for while to finish before printing if on the
sameline,why?(countdown prog)




Try this

my $countdown = 5;
local $|=1 ;
while ($countdown > 0){
print "\.";
sleep 1;
$countdown--;
}
print "Kaboom!!"
-Original Message-
From: Mark Jayson Alvarez [mailto:[EMAIL PROTECTED]
Sent: Monday, February 21, 2005 9:39 AM
To: beginners@perl.org
Subject: Perl waits for while to finish before printing if on the same
line,why?(countdown prog)


Hi,
  I'm new to perl and i'm trying to create a simple
program that will act like a time bomb but will print
a dot(something like a progress bar every second until
the specified time arrives. Here's my code.

my $countdown = 5;
while ($countdown > 0){
print "\.";
sleep 1;
$countdown--;
}
print "Kaboom!!"

And the result..
after waiting for 5 seconds, it displayed this line at
once:

.Kaboom!!


Why does this happens with a while loop? I told it to
print a single dot every 1 second. Do you know another
way of making my progress bar program that display a
single dot every one second on the same line until it
reaches a given time?

Thank you!









__ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250

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



*
Disclaimer:

The contents of this E-mail (including the contents of the enclosure(s)
or attachment(s) if any) are privileged and confidential material of MBT
and should not be disclosed to, used by or copied in any manner by
anyone other than the intended addressee(s).   In case you are not the
desired addressee, you should delete this message and/or re-direct it to
the sender.  The views expressed in this E-mail message (including the
enclosure(s) or attachment(s) if any) are those of the individual
sender, except where the sender expressly, and with authority, states
them to be the views of MBT.

This e-mail message including attachment/(s), if any, is believed to be
free of any virus.  However, it is the responsibility of the recipient
to ensure that it is virus free and MBT is not responsible for any loss
or damage arising in any way from its use

*

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


*
Disclaimer:

The contents of this E-mail (including the contents of the enclosure(s)
or attachment(s) if any) are privileged and confidential material of MBT
and should not be disclosed to, used by or copied in any manner by
anyone other than the intended addressee(s).   In case you are not the
desired addressee, you should delete this message and/or re-direct it to
the sender.  The views expressed in this E-mail message (including the
enclosure(s) or attachment(s) if any) are those of the individual
sender, except where the sender expressly, and with authority, states
them to be the views of MBT.

This e-mail message including attachment/(s), if any, is believed to be
free of any virus.  However, it is the responsibility of the recipient
to ensure that it is virus free and MBT is not responsible for any loss
or damage arising in any way from its use

*

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




RE: Perl waits for while to finish before printingifonthesameline,why?(countdown prog)

2005-02-20 Thread Mallik
I am using it as a command line tool. I have perl configured in Edit
Plus. Thru edit plus, it is not working as expected, where as from
command line, it is working fine.

Mallik.

-Original Message-
From: Manav Mathur [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 21, 2005 1:28 PM
To: Mallik; beginners@perl.org
Cc: 'Mark Jayson Alvarez'
Subject: RE: Perl waits for while to finish before
printingifonthesameline,why?(countdown prog)



The same code works here on ActivePerl. As far as I know, some
web-servers
do default buffering...thats why I asked if you were using it as CGI

Manav

-Original Message-----
From: Mallik [mailto:[EMAIL PROTECTED]
Sent: Monday, February 21, 2005 1:21 PM
To: 'Manav Mathur'; beginners@perl.org
Cc: 'Mark Jayson Alvarez'
Subject: RE: Perl waits for while to finish before printing
ifonthesameline,why?(countdown prog)


Hi Manav,

Same code is working as expected in Unix OS, but not in Windows.

Thanks,
Mallik.

-Original Message-
From: Manav Mathur [mailto:[EMAIL PROTECTED]
Sent: Monday, February 21, 2005 1:17 PM
To: Mallik; beginners@perl.org
Cc: 'Mark Jayson Alvarez'
Subject: RE: Perl waits for while to finish before printing if
onthesameline,why?(countdown prog)



Are you using it as a command line tool or as CGI etc??

Manav

-Original Message-
From: Mallik [mailto:[EMAIL PROTECTED]
Sent: Monday, February 21, 2005 1:12 PM
To: beginners@perl.org
Cc: 'Manav Mathur'; 'Mark Jayson Alvarez'
Subject: RE: Perl waits for while to finish before printing if on
thesameline,why?(countdown prog)


Still the result is same.

-Original Message-
From: Manav Mathur [mailto:[EMAIL PROTECTED]
Sent: Monday, February 21, 2005 1:11 PM
To: Mark Jayson Alvarez; beginners@perl.org
Subject: RE: Perl waits for while to finish before printing if on the
sameline,why?(countdown prog)




Try this

my $countdown = 5;
local $|=1 ;
while ($countdown > 0){
print "\.";
sleep 1;
$countdown--;
}
print "Kaboom!!"
-Original Message-
From: Mark Jayson Alvarez [mailto:[EMAIL PROTECTED]
Sent: Monday, February 21, 2005 9:39 AM
To: beginners@perl.org
Subject: Perl waits for while to finish before printing if on the same
line,why?(countdown prog)


Hi,
  I'm new to perl and i'm trying to create a simple
program that will act like a time bomb but will print
a dot(something like a progress bar every second until
the specified time arrives. Here's my code.

my $countdown = 5;
while ($countdown > 0){
print "\.";
sleep 1;
$countdown--;
}
print "Kaboom!!"

And the result..
after waiting for 5 seconds, it displayed this line at
once:

.Kaboom!!


Why does this happens with a while loop? I told it to
print a single dot every 1 second. Do you know another
way of making my progress bar program that display a
single dot every one second on the same line until it
reaches a given time?

Thank you!









__
Do you Yahoo!?
Yahoo! Mail - 250MB free storage. Do more. Manage less.
http://info.mail.yahoo.com/mail_250

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



*
Disclaimer:

The contents of this E-mail (including the contents of the enclosure(s)
or attachment(s) if any) are privileged and confidential material of MBT
and should not be disclosed to, used by or copied in any manner by
anyone other than the intended addressee(s).   In case you are not the
desired addressee, you should delete this message and/or re-direct it to
the sender.  The views expressed in this E-mail message (including the
enclosure(s) or attachment(s) if any) are those of the individual
sender, except where the sender expressly, and with authority, states
them to be the views of MBT.

This e-mail message including attachment/(s), if any, is believed to be
free of any virus.  However, it is the responsibility of the recipient
to ensure that it is virus free and MBT is not responsible for any loss
or damage arising in any way from its use

*

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


*
Disclaimer:

The contents of this E-mail (including the contents of the enclosure(s)
or attachment(s) if any) are privileged and confidential material of MBT
and should not be disclosed to, used by or copied in any manner by
anyone other than the intended addressee(s).   In case you are not the
desired addressee, you should delete this message and/or re-direct it to
the sender.  The views expressed in this E-mail message (including the
enclosure(s) or at

RE: Verify that a directory exists.

2005-02-28 Thread Mallik
if (-d ) {
print "Directory exists\n";
}

-Original Message-
From: Carlos Mantero [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 28, 2005 5:09 PM
To: Perl BG
Subject: Verify that a directory exists.


Hi all,

I'm a begginer in Perl and other programming languages. I want to verify
that a directory exists, but I don't know the way tho do it.

Regards.
-- 
Carlos Mantero  

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




Multiple file upload

2005-03-02 Thread Mallik
Dear All,
 
Anybody knows how to upload multiple files from a web page to server
without using multiple file upload fields?
 
Assumption: All files are in same directory?
 
The user can provide the folder path (own PC) where the files exist.
 
We don't want the user to click the browse buttons multiple times to
upload multiple files (no. of files may be more than 10 or so). So, we
want to avoid multiple file upload fields on the page.
 
FYI, Our application is in Perl.
 
Any suggestion on this is highly appreciated.

Thanks in advance,
Mallik.

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




Errors while inserting into long data type

2005-04-11 Thread Mallik
Hi Friends,

I am using oracle database and I have column of long data type. I insert the
data into this column thru perl script. If the inserted data exceeds 4000
chars, it is giving me the following error.

DBD::Oracle::st execute failed: ORA-01704: string literal too long (DBD
ERROR: OCIStmtExecute) at MT/TACDbManager.pm line 445.

Whereas we can insert upto 2GB of data in long data type.

Pl. help me out to solve this.

Thanks & Regards,
Mallik.

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

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




RE: Errors while inserting into long data type

2005-04-11 Thread Mallik
Hi Philip,

Thanks for your reply. It worked with bind_param. 

I have one more question, how to set the LongReadLen parameter in a perl
script?

Thanks,
Mallik.  

-Original Message-
From: Philip Mikal [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 11, 2005 11:36 PM
To: 'Mallik'; [EMAIL PROTECTED]
Subject: RE: Errors while inserting into long data type

Hi Mallik,

String literals in Oracle are limited to 4000 characters. 

http://www.google.com/search?hl=en&q=Inserting+and+Updating+LONG%2FLOB+Colum
ns

Also, you may find using the perl-trolls alias better for general perl
programming questions.

Regards,
 
Philip Mikal
ITD Webteam
Cisco Internet Experts

-Original Message-
From: Mallik [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 11, 2005 4:10 AM
To: [EMAIL PROTECTED]
Subject: Errors while inserting into long data type

Hi Friends,

I am using oracle database and I have column of long data type. I insert the
data into this column thru perl script. If the inserted data exceeds 4000
chars, it is giving me the following error.

DBD::Oracle::st execute failed: ORA-01704: string literal too long (DBD
ERROR: OCIStmtExecute) at MT/TACDbManager.pm line 445.

Whereas we can insert upto 2GB of data in long data type.

Pl. help me out to solve this.

Thanks & Regards,
Mallik.

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




How to change the value of a Hash Key

2005-06-07 Thread Mallik
Hi,

I have a below hash (printed using Dumper).

$VAR1 = {
  'Technologies':'Optical':'Dense Wavelength Division Multiplexing
(DWDM)'
  };
$VAR2 = {
  'typeInfoSortKey' => '',
  'mdfName' => 'Linear with Optical Add/Drop Multiplexing (OADM)',
  'childKeys' => '',
  'docs' => '',
  'docTitles' => '',
  'mdfId' => '279524369',
  'level' => '4',
  'parentMdfId' => '268436078',
  'count' => 0,
  'link' => 'Linear_with_Optical_Add_D_279524369.html'
};

Here, the key is 'Technologies':'Optical':'Dense Wavelength Division
Multiplexing (DWDM)'.

Now, I want to replace it with something like 'abc'.

Any pointers on this?

Thanks & Regards,
Mallik



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




RE: How to change the value of a Hash Key

2005-06-08 Thread Mallik
Hi Thomas,

Thanks for your reply.

I want to accomplish some thing like this...

%hash = (
"abc" => "mallik",
"xyz" => "arjun",
"mno" => "priya"
);

Need be changed to

%hash = (
"123" => "mallik",
"243" => "arjun",
"532" => "priya"
);

The key value abc is changed to 123 and so on..

Hope my requirements are clear now.

Any help in this regard is greatly appreciated.

Thanks & Regards,
Mallik

-----Original Message-
From: Thomas Bätzler [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 08, 2005 11:50 AM
To: 'beginners@perl.org'
Cc: 'Mallik'
Subject: RE: How to change the value of a Hash Key

Mallik <[EMAIL PROTECTED]> asked:

> I have a below hash (printed using Dumper).
[...]
> Here, the key is 'Technologies':'Optical':'Dense Wavelength 
> Division Multiplexing (DWDM)'.
> 
> Now, I want to replace it with something like 'abc'.
> 
> Any pointers on this?

Did you mean something like this?

$hash{'bar'} = $hash{'foo'};
delete $hash{'bar'};

HTH,
Thomas


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

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




Database Paging using CGI Perl

2003-12-12 Thread Mallik
Dear Friends,

I am using Informix database. I want to implement
database paging concept on Informix using CGI Perl.

Please provide me any sample code.

Thanks in Advance,

With Regards,
Mallikarjun.

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




Please wait while I get your data ...

2003-12-18 Thread Mallik
Hi Bill,

We are also looking for the same solution

My problem is, I have to fetch data from tbe database
and display it on browser. The datbase is very huge.
It is taking more time to query the data. Mean while
timeout error is occuring on the browser.

So, we are also looking for the same solution you
are looking for. If you find any, pl. forward us.

NOTE: Database is Informix and we are using Perl CGI.

Thanks,
Mallik.

-Original Message-
From: Bill McCormick [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 18, 2003 9:42 PM
To: Cgiapp
Subject: [cgiapp] Please wait while I get your data ...


Hi all,

I'm trying to come up with a (simple?) way to display an intermediate page
to a user while waiting for MySQL to return results for a final page.
Comments, suggestions, advice, insight for the pros appreciated.


Thanks,


Bill


-
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
  http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
  http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
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]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Regular Exp for Numerics

2004-01-11 Thread Mallik
Dear Friends,

I have to compare numeric values as below

if (($segsep == 13) || ($segsep == 10) || ($segsep == 0))

Can I use the reg exp as below

if ($segsep =~ /^(13|10|0)$/)

My question is, is it adviceable to use reg exp for numeric values (entire
value).
If yes, why?
If not, why?

Thank you,
Mallik


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




Regular Exp for Numerics

2004-01-12 Thread Mallik
Dear Friends,

I have to compare numeric values as below

if (($segsep == 13) || ($segsep == 10) || ($segsep == 0))

Can I use the reg exp as below

if ($segsep =~ /^(13|10|0)$/)

My question is, is it adviceable to use reg exp for numeric values (entire
value).
If yes, why?
If not, why?

Thank you,
Mallik


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




Regarding unless in Perl

2004-01-19 Thread Mallik
Dear Friends,

I have the following code

unless(-d $dir)
{
   unless(mkdir $dir)
   {
print "Error\n";
   }
}

Can I rewrite the above code in the following way

unless (-d $dir | mkdir $dir)
{
   print "Error\n";
}

Thanks in advance,

Mallik.

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




Day of the week by accepting date from User

2004-01-20 Thread Mallik
Dear Friends,

How to calculate the Day of the week for a given date
in PERL.

Please provide me any code available that doesn't require
any other modules to be installed.

Thanks in advance,
Mallik.

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




RE: Automated script to connect to a web site and change the Password

2004-01-28 Thread Mallik
Dear Friends,

I need to write a Perl CGI script that connects to
a website (like Yahoo) and change the Password for
my user. I don't want to do it manually. It should
be handled by the script.

Please suggest any idea/code available.

Thanks in advance,
Mallik.

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




Automated script to connect to a web site and change the Password

2004-01-28 Thread Mallik
Dear Friends,

I need to write a Perl CGI script that connects to
a website (like Yahoo) and change the Password for
my user. I don't want to do it manually. It should
be handled by the script.

Please suggest any idea/code available.

Thanks in advance,
Mallik.

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




RE: Automated script to connect to a web site and change the Password

2004-01-28 Thread Mallik
Dear Friends,

I need to write a Perl CGI script that connects to
a website (like Yahoo) and change the Password for
my user. I don't want to do it manually. It should
be handled by the script.

Please suggest any idea/code available.

Thanks in advance,
Mallik.

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




Formatting the decimals

2004-01-29 Thread Mallik
Dear Friends,

How do I format the decimals, i.e, if there is no
decimal part, then add .00, if there is one decimal,
then add '0'.

For eg., how to convert 123 to 123.00
and 123.5 to 123.50.

Thanks in advance,
Mallik.

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




What is eval?

2004-01-29 Thread Mallik
Can anybody explain the functionality of eval in brief?

Thanks in advance,
Mallik.

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




Use and Require

2004-01-29 Thread Mallik
Dear Perl Gurus,

What is the difference between Use and Require.

Thanks,
Malliks

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




map?

2004-01-31 Thread Mallik
I couldn't understand the functionality of map in PERL. Is there anybody to
help me?

Thanks,
Mallik.


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




Virtual Directory Problem

2004-02-14 Thread Mallik
Dear Friends,

In Apache, the /usr/local/fsuser/sbin directory is mapped to the
virtual directory http://192.168.0.10/fsuser/cgi-bin/.

>From browser, I am able to access all the .cgi and .pl files
present in the /usr/local/fsuser/sbin and its subdirectories.

But I am not able to access the html files present in this
directory. When I am giving the following URL it is giving
the Premature end of script error.

http://192.168.0.10/fsuser/cgi-bin/help.htm.

Whereas, I am able to access the same html with the following URL.

http://192.168.0.10/help.htm.


How can I access the html file with the URL
http://192.168.0.10/fsuser/cgi-bin/help.htm

Thanks,
Mallik.


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




Passing array as First argument

2004-03-03 Thread Mallik

Dear Friends,

I need to pass 3 parameters to a subroutine, in which the
first parameter is an array and the last two parameters
are strings.

@abc = qw(1 2 3);
$x = 4;
$y = 5;

testsub(@abc, $x, $y);

sub testsub(@$$)
{
(@abc, $x, $y) = @_;
print "Array @abc\n";
print "x $x\n";
print "y $y\n";
}

The output of the above code is
Array 1 2 3 4 5
x 
y 

As seen above, all the parameters are assigned to the array.

So, how can get the values into x and y.

Thanks in advance.
Mallik.

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




Passing array as First argument

2004-03-03 Thread Mallik
Dear Friends,

I need to pass 3 parameters to a subroutine, in which the
first parameter is an array and the last two parameters
are strings.

@abc = qw(1 2 3);
$x = 4;
$y = 5;

testsub(@abc, $x, $y);

sub testsub(@$$)
{
(@abc, $x, $y) = @_;
print "Array @abc\n";
print "x $x\n";
print "y $y\n";
}

The output of the above code is
Array 1 2 3 4 5
x 
y 

As seen above, all the parameters are assigned to the array.

So, how can get the values into x and y.

Thanks in advance.
Mallik.

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




Creating Menus in CGI

2004-03-19 Thread Mallik
Dear Friends,

How to create menus using Perl CGI?

Any help in this regard will be great.

Thank you,
Mallik.

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




How to add CPAN in PPM Repository

2004-03-22 Thread Mallik
Hi Friends,

I want to install the modules available in CPAN. When I typed "rep" at ppm
command prompt, I got the following repositories.

Repositories:
[1] ActiveState PPM2 Repository
[2] ActiveState Package Repository

To add CPAN into repository, I typed the below command

ppm> rep add "CPAN" http://search.cpan.org/
Repositories:
[1] ActiveState PPM2 Repository
[2] ActiveState Package Repository
[3] CPAN

Now, the CPAN is added, but I am unable to install the modules in CPAN.
When I tried to install DBD::Oracle, I am getting the following error

ppm> install DBD::Oracle
Missing base argument at c:/Perl/site/lib/PPM/Repository.pm line 174

Please help me to configure CPAN in repository and install DBD::Oracle
directly from PPM.

Thanks in advance,
Mallik.


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




How to read a pdf file in perl

2004-05-14 Thread Mallik
Dear Friends,
 
I want to parse a pdf file as we do for text files using perl. Can anyone help me out?
 
Thanks,
Mallik.


-
  Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download 
Messenger Now

RE: How to read a pdf file in perl

2004-05-14 Thread Mallik
Hi Dani,

By the OS is AIX, similar to UNIX. So, is there any module
to install in AIX (UNIX) and read the pdf file.

Thanks,
Mallik.

-Original Message-
From: Dani Pardo [mailto:[EMAIL PROTECTED]
Sent: Friday, May 14, 2004 1:57 PM
To: [EMAIL PROTECTED]
Cc: Mallik
Subject: Re: How to read a pdf file in perl


On Friday 14 May 2004 09:33, Mallik wrote:
> Dear Friends,
>
> I want to parse a pdf file as we do for text files using perl. Can anyone
> help me out?

 Hi, you may check PDF::API2, it's a pretty nice module.

---
Dani Pardo, [EMAIL PROTECTED]
ENPLATER S.A

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







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




Search and Replace

2004-07-26 Thread Mallik
Dear Friends,

I have the below string.

$str = "iabd  a  bdkf a kdfkj akdfakjkf";

I want to replace all the 'a' s prceeded and followed by spaces with 'A'.

The output should be like this

$str = "iabd  Abdkf A kdfkj akdfakjkf";

Any easy reg exp?

Regards,
Mallik.


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




Reg Exp

2004-10-05 Thread Mallik
Dear Friends,

I have the below code.

my $a = ":-:m:-:a:-:l:-:i:-:k"; # Here each letter is separated by :-:
my $del = ':-:'; # Delimeter
my $b;

while ($a ne $b)
{
$a =~ /^$b$del(.?)($del)?/;
my $c = $1;
print "$c\n";
$b .= $del . $c;
}

The above code is working fine. But when I change the text in $a like below

$a = ":-:m:-:a:-:l:-::-:k";  # Here I removed the letter l between two '::'s

Now the code is not working properly.

Any help in this is appreciated.

Note: There may be non-alpha numeric chars between ':-:'.

Regards,
Mallik.


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




RE: Reg Exp

2004-10-05 Thread Mallik
Hi David,

Thanks for ur suggestion.

But I am a new-bie to Perl. Can u give me a example for 'look-ahead'
matches.

Regards,
Mallik.

-Original Message-
From: David le Blanc [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 05, 2004 5:57 PM
To: John W. Krahn
Cc: Perl Beginners
Subject: Re: Reg Exp


Your use of (.?)($del)? does not do what you expect.  In the case of
:-:a:-:   you will find (.?) = 'a' and ($del)? matches a delimiter, BUT
:-::-:you will find (.?) = ":" and ($del)? matches nothing.

Check out 'look-ahead' matches for a way to solve this.



On Tue, 05 Oct 2004 04:03:21 -0700, John W. Krahn <[EMAIL PROTECTED]> wrote:
> Mallik wrote:
> > Dear Friends,
>
> Hello,
>
> > I have the below code.
> >
> > my $a = ":-:m:-:a:-:l:-:i:-:k"; # Here each letter is separated by :-:
> > my $del = ':-:'; # Delimeter
> > my $b;
> >
> > while ($a ne $b)
> > {
> > $a =~ /^$b$del(.?)($del)?/;
> > my $c = $1;
> > print "$c\n";
> > $b .= $del . $c;
> > }
> >
> > The above code is working fine. But when I change the text in $a like
below
> >
> > $a = ":-:m:-:a:-:l:-::-:k";  # Here I removed the letter l between two
'::'s
> >
> > Now the code is not working properly.
> >
> > Any help in this is appreciated.
> >
> > Note: There may be non-alpha numeric chars between ':-:'.
>
> Perhaps you need to use split and join:
>
> $a = ':-:m:-:a:-:l:-::-:k';
>
> my $del = ':-:'; # Delimeter
>
> $b = join $del, split $del, $a, -1;
>
> 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>
>
>

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



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




RE: Comparing two directories

2004-10-27 Thread Mallik
I think the code can be further optimized without traversing through 2nd
directory as below.

opendir RD,"." or die "ERROR: $!\n";
my $dir2 = "../";

my @DIR1 = readdir RD;
foreach my $filename (@DIR1) {

 next if $filename =~/^\./;

 my $fname = $dir2 . $filename;
 if (-e $fname) {
   print "$filename\n" if $filename eq $_ ;
  }
}


-Original Message-
From: Mark Goland [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 28, 2004 9:29 AM
To: Vladimir Lemberg; [EMAIL PROTECTED]
Subject: Re: Comparing two directories



- Original Message -
From: "Vladimir Lemberg" <[EMAIL PROTECTED]>
To: "Vladimir Lemberg" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, October 27, 2004 8:16 PM
Subject: Re: Comparing two directories

Hello,
I beleave the two codes you have posted will yield identical results, as
there are a few problems . let me go through it and comment


> Actually, this is my script:
>
> foreach $filename(readdir DIR1) {
remember this will read entire DIR1, and triverse through the list of
files in created list

>  next if $filename =~/^\./;
>   while (readdir DIR2){
>   print "$filename\n" if (-e $filename);
>   last;
 this will take effect first time through, which means two things
1. You will only check 1 filename from second directory each time
through
2. You will  check next file in DIR2 directory next time through
if you want to go through this route, you will need to rewind directory
handle each time you brake from this loop [ perldoc -f rewinddir ]
>   }
> }

You should probably read the entire directory contents at a timehere is
example on how one can achieve your goal.

#!PERl

use warnings;
use strict;
use Data::Dumper;
$|=1;

my %hash;

opendir RD,"." or die "ERROR: $!\n";
opendir RD2,".." or die "ERROR: $!\n";

my @DIR1 = readdir RD;
my @DIR2 = readdir RD2;


foreach my $filename (@DIR1) {

 next if $filename =~/^\./;

  foreach (@DIR2){

   print "$filename\n" if $filename eq $_ ;

  }

}



>
>
> - Original Message -
> From: "Vladimir Lemberg" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, October 27, 2004 5:14 PM
> Subject: Comparing two directories
>
>
> Hi,
>
>
>
> Could you help me to find what's wrong in my script?
>
>
>
> I need to compare two directories and if file exists in both - print it.
>
>
>
> die "Usage: 2 arguments must be passed i.e. file1 file2\n" if @ARGV != 2;
> opendir DIR1, $ARGV[0] or die "couldn't open $ARGV[0] for reading.\n";
> opendir DIR2, $ARGV[1] or die "couldn't open $ARGV[1] for reading.\n";
>
> foreach $filename(readdir DIR1) {
>next if $filename =~/^\./;
>  while (readdir DIR2){
>if (-e $filename){
>print "$filename\n"}
>  }
>  }
> closedir(DIR1);
> closedir(DIR2);
>
>
>
> Looks like I'm checking "if exists" in first directory but not in second.
>
>
>
> -Vladimir
>
> --
> 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]
 



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