RE: Read a single line in a file.

2005-07-29 Thread arjun.mallik

Original Message-
From: Umesh T G [mailto:[EMAIL PROTECTED]
Sent: Friday, July 29, 2005 3:47 PM
To: beginners@perl.org
Subject: Read a single line in a file.


Hello List,

I have a file with multiple lines. I want to read only the first line.
and a particular word in that line.

For eg:
File.txt

apple,grape,orange,banana
some other lines
continued.

So I want only the word grape here. How to get it?

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


Hi ,

Follow the below procedure , may solve your problem. But be more prsice
with your problems.


Open( READ," open the file in read mode

$line=;

$line=~ /^[a-z]*,([a-z]*),.*/;   ---> captures  the second word of the
line.

Print "desired word is  $1 \n";

---


Is this what u want ?

--
Arjun



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]
 




checking the reachability of the remote host

2005-07-28 Thread arjun.mallik


Hi ,
I have to verify whether the servers [windows , Linux ] which are
integrated to my Unix machine are alive or not .


I am using Net::Ping.

Problem i am facing is , i am able to verify all Unix machines
integrated .

And not  the Windows & Linux machines which integrated to my UNIX box.


please Help me if you are aware.


-clip---
use Net::Ping;
my $p = Net::Ping->new(); $host="guis1.w2kr41.r41.xxx..com";
print "HOST is --> $host \n";
   if (  $p->ping($host) )
{
  print "pingable host --> $host\n";


}
---clip---


Thanks
Arjun


Deserve before you desire






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]
 






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]
 




Pinging from perl script

2005-07-28 Thread arjun.mallik

Hi ,
I have to verify whether the servers [windows , Linux ] which are
integrated to my Unix machine are alive or not .

I am using Net::Ping.
Problem i am facing is , i am able to verify all Unix machines
integrated .
And not  the Windows & Linux machines which integrated to my UNIX box.

please Help me if you are aware.

-clip---
use Net::Ping;
my $p = Net::Ping->new();
$host="guis1.w2kr41.r41.xxx..com";
print "HOST is --> $host \n";
   if (  $p->ping($host) )
{
  print "pingable host --> $host\n";

}
---clip---

Thanks
Arjun

Deserve before you desire





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]
 




using ping on Net module

2005-07-28 Thread arjun.mallik

Hi ,

I have to verify whether the servers [windows , Linux ] which are
integrated to my Unix machine are alive or not .

I am using Net::Ping.
Problem i am facing is , i am able to verify all Unix machines
integrated .
And not  the Windows & Linux machines which integrated to my UNIX box.

please Help me if you are aware.

-clip---
use Net::Ping;
my $p = Net::Ping->new();
$host="guis1.w2kr41.r41.xxx..com";
print "HOST is --> $host \n";
   if (  $p->ping($host) )
{
  print "pingable host --> $host\n";

}
---clip---


Thanks
Arjun
If we can imagine a future, we can create it.
If we can create that future, others will live in it.







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.

using ping on Net module

2005-07-28 Thread arjun.mallik

Hi ,
I have to verify whether the servers [windows , Linux ] which are
integrated to my Unix machine are alive or not .

I am using Net::Ping.
Problem i am facing is , i am able to verify all Unix machines
integrated .
And not  the Windows & Linux machines which integrated to my UNIX box.

please Help me if you are aware.

-clip---
use Net::Ping;
my $p = Net::Ping->new();
$host="guis1.w2kr41.r41.xxx..com";
print "HOST is --> $host \n";
   if (  $p->ping($host) )
{
  print "pingable host --> $host\n";

}
---clip---


Thanks
Arjun
If we can imagine a future, we can create it.
If we can create that future, others will live in it.






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.

RE: set environment variables

2005-07-18 Thread arjun.mallik

Oops ,
Mine was a wild guess and I am sorry for that. The below test was
successful in setting environment variable ...

 clip
#!/usr/bin/perl
use Env;

print "Before -->";
print  %ENV;
print "\n";
$ENV{TEMP}="xxx";
print "After --> \n";
print  %ENV;
print "\n";

system("echo $TEMP");
-clip--


Br
Arjun

Deserve before you desire







-Original Message-
From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 19, 2005 9:20 AM
To: Mallik Arjun (WT01 - TELECOM SOLUTIONS)
Cc: [EMAIL PROTECTED]; beginners@perl.org
Subject: Re: set environment variables


"Because it's up-side down.
Why is that?
It makes replies harder to read.
Why not?
Please don't top-post." - Sherm Pendley, Mac OS X list


[EMAIL PROTECTED] wrote:
> Hi ,
> Try below.
> If you are using csh  for executing perl script -->
system("setenv
> TEMPHOME /tmp ");
> If your using bash for executing perl script ->   $TEMPHOME =
> "/tmp";
>
> system("export $TEMPHOME");
>
>
> Arjun
>
> Deserve before you desire
>
>

Did you test it? The problem with this approach is that you are setting
the environment in the subshell of 'system', but as soon as you have set
that variable your 'system' returns, the subshell process is destroyed
and the "new" environment has disappeared again. You must set the
environment once in the same subshell as the command you wish to run in
that shell. Generally you have the way the other posters have shown, by
setting the environment in Perl and then allowing the subshell to
inherit that environment, or by passing multiple commands in a single
shell call, generally by separating them with a semi-colon.

It is because each call to 'system' creates its own exclusive subshell
that the more obvious,

system("export VAR=value");
system("some_other_command");

Does not work.

http://danconia.org

>
>
>
>
>
> -Original Message-
> From: Nishi Prafull [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 19, 2005 1:49 AM
> To: Perl Beginners List
> Subject: set environment variables
>
>
> Hi:
>
> I need to run a script noted by $cmd1 from within perl but before that

> i need to set the environment variable. how can i do it? I tried my
> $TEMPHOME = "/tmp"; system($cmd1);
>
> But the script still complains the $TEMPHOME is not set. Thanks.
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
>
>
>
>
>
> 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.
>



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]
 




RE: set environment variables

2005-07-18 Thread arjun.mallik

Hi ,
Try below.
If you are using csh  for executing perl script -->   system("setenv
TEMPHOME /tmp ");
If your using bash for executing perl script ->   $TEMPHOME =
"/tmp";

system("export $TEMPHOME");


Arjun

Deserve before you desire







-Original Message-
From: Nishi Prafull [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 19, 2005 1:49 AM
To: Perl Beginners List
Subject: set environment variables


Hi:

I need to run a script noted by $cmd1 from within perl but before that i
need to set the environment variable. how can i do it? I tried my
$TEMPHOME = "/tmp"; system($cmd1);

But the script still complains the $TEMPHOME is not set. Thanks.

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





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]
 




RE: query about hash

2005-07-15 Thread arjun.mallik

Hi ,

Yes dumper helped up to some extent. My HASH is some thing like below,
---
extract is HASH(0x4039ca60)
$VAR1 = {
  'Cluster' => '26'
};


But I want it to be  like below. How to add two keys and two values to
hash.

--
extract is HASH(0x4039ca60)
$VAR1 = {
  'Cluster' => '26'
   'Version' => '3.1'
};
-

File from which hash is prepared contains
---
( Saturday ""
( Cluster "26" , Version "3.1" )
( Cluster "991041" , Version "4.0" )
)
-

thanks

Arjun

Deserve before you desire







-Original Message-
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]
Sent: Friday, July 15, 2005 9:22 PM
To: Mallik Arjun (WT01 - TELECOM SOLUTIONS)
Cc: beginners@perl.org
Subject: Re: query about hash


On Jul 15, [EMAIL PROTECTED] said:

> foreach $cluster ( @{$schedules->{$DAY->[friday]}->{STRUCT}} )
>
> from $cluster i have to extract cluster number and version. How can i
> do that ??
>
> Output is like below.
> -
> extract is HASH(0x4033d910)  << From this 2 values are to be retrived
.
> upload cluster version is clver
> 

Well, *we* don't know what $cluster looks like, but *you* can.  By
printing it, you've been told by Perl that it's a hash reference.
Therefore, you can see what it looks like by doing:

   for my $ckey (keys %$cluster) {
 print "$ckey => $cluster->{$ckey}\n";
   }

Or you could even just do:

   use Data::Dumper;
   print Dumper($cluster);

--
Jeff "japhy" Pinyan %  How can we ever be the sold short or
RPI Acacia Brother #734 %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %-- Meister Eckhart



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]
 




query about hash

2005-07-15 Thread arjun.mallik

Hi ,
I have a script which reads from flat file and stores data in  a
variable in the form of hash.


code
-
foreach $cluster ( @{$schedules->{$DAY->[friday]}->{STRUCT}} )
-

from $cluster i have to extract cluster number and version. How can i do
that ??

flat file looks like below
-
( Friday ""
(
( Cluster "XX"  )
( Version "3.1" )
)
(
( Cluster "Y" )
( Version "4.0"   )
)
)
---

Output is like below.
-
extract is HASH(0x4033d910)  << From this 2 values are to be retrived .
upload cluster version is clver



Thanks  in advance
Arjun
If we can imagine a future, we can create it.
If we can create that future, others will live in it.






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.

RE: 0; and 1;

2005-07-14 Thread arjun.mallik

Hi ,

I have executed a Perl script from csh[c shell ] and  saw that exit
 is for shell from where it is invoked .
Exit 100; at the end is captured by shell.
Exit value can be  up to 127.

But I couldn't get what is ;  Stands for.

Any one can help here ... please

Thanks in advance
Arjun

Deserve before you desire







-Original Message-
From: Beast [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 14, 2005 9:29 AM
To: beginners perl
Subject: 0; and 1;



I coudn't find any reference (yet) the meaning of 0; or 1; in the end of

perl program.

It means exit or return value? when I explicitly type "return 0;" it
gives error, but when I give "exit 100;" the value of $$ isn't 100
anyway.


--

--beast


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





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]
 




RE: Regular Expressions

2005-07-13 Thread arjun.mallik

Hi ,
Use  the expression/^G.*G$/

^ > Denotes the beginning of the line
$ -> denotes ending of the line

if u dont want case sensitivity

use/^G.*G$/i

i --> ignores case sensitivity

Arjun

Deserve before you desire







-Original Message-
From: April T.Barrett [ 
mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 13, 2005 3:49 AM
To: beginners@perl.org
Subject: Regular Expressions


Hello:



  I need some tips on going about regular expression:



parsing through a text file and printing all of the words that - for
example -

Begin and end with an "G"



Thanks.






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

RE: General questions

2005-03-30 Thread arjun.mallik

Hi Kumaran,

Use strict is used to enforce declaration of variables before we use
them.
Here IN_FILE1 is file pointer variable which u are using and which is
not declared before ,
That is the reason it is working fine when u have removed the use strict
construct.

Thanks
Arjun

Deserve before you desire







-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 30, 2005 1:28 PM
To: M.L. PERL BEG
Subject: General questions


Hello,

1.  I read on many Perl/CGI tutorial/articles that it is best to place
and use CGI files in /cgi-bin/ directory than anywhere else, due to
avoid many problems.  Buy in our website, we have several subdomain and
those are all use the same /cgi-bin/ directory, so now there are a lot
of files populated there.  So now what I have to do to reduce the
management/maintanence problems.


2. I used "use strict", and I get error for the statement open(IN_FILE1,
">>test_records.txt");

Here the error is
Bareword "IN_FILE1" not allowed while "strict subs" in use 

But if I remove "use strict", the program works well.  So should I
definately do not use "use strict" if the program want to handle I/O
files?


Thank you all.

Greetings,
R. Kumaran



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





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]
 




Reg parameters to a perl script

2005-02-07 Thread arjun.mallik

Hi ,
I have a perl script which accepts few  predefined parameters  and
values for them.
It is like this :
 myscript.pl -param1  -param2 

Now  my requirement is ,  if value is also has and hyphen "-" then
script  should accept it and what ever i give after the -param option
should be taken as a single string .

Now the script is raising exception as unknown parameters . My code is
like below

==
   "param=s"   => [EMAIL PROTECTED]);
  print "Parameters passed are @PARAM\n";
  print "paramerts in default ARGV are @ARGV\n";


and calling the script as


myscript.pl -noexecute -context MALLIK -param -pkg webring web/hosts
--env
===

The output is

==
Unknown option: env
Parameters passed are -pkg
paramerts in default ARGV are webring web/hosts
==

Any help plz  ... Thanks in advance

Arjun

Deserve before you desire










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.

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

2005-01-26 Thread arjun.mallik

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]
 





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]
 




RE: Is CYGWIN a unix like environment to run PERL modules?

2005-01-18 Thread arjun.mallik

Hi
CYGWIN installation is in two parts , I am not sure whether u have
followed that ?
And CYGWIN is like X-windows to work on UNIX session from Windows
machines... Other s/w like this are Exceed [ licensed..].
If u want I can give u the full CYGWIN s/w I have.

cheers
Arjun

Deserve before you desire







-Original Message-
From: Zapa Perl [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 18, 2005 1:11 PM
To: beginners@perl.org
Subject: Is CYGWIN a unix like environment to run PERL modules?


Hello,

I installed CYGWIN on Win-2000 hoping to have a Linux like environment
and run PERL. I was expecting to click on the CYGWIN desktop icon and
get a prompt window and move on. but that is not what I got. when I
double click on CYGWIN desktop icon something flashes and disappears
quickly and no chance of doing anything. how do I get to CYGWIN prompt
window?
or how do I get to Linux like environment to run my PERL modules? thank
you in advance. Zapa.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com



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]
 




RE: Regarding strings

2005-01-07 Thread arjun.mallik

Hi Frnds,
Found solution.


  $len = length($temp);
if ($len > 2)
{
 $temp=substr($temp,$len-2,2);
}


Thanks
Arjun

Deserve before you desire







-Original Message-
From: Alfred Vahau [mailto:[EMAIL PROTECTED]
Sent: Friday, January 07, 2005 11:02 PM
To: beginners@perl.org
Subject: Re: Regarding strings


perldoc -f substr

alfred,


[EMAIL PROTECTED] wrote:

>Hi Frnds,
>If I have a number of 6 digits. How to get the last 2 digits. This
>should be valid even when i have 2 digits as input. i.e If input is
>991041 then output shud be 41
> if input is  41 then output shud be 41
>
>
>May be junk and simple question but ..i need this ..please do respond..
>
>
>
>
>Thanks in advance
>
>Arjun
>
>
>Deserve before you desire
>
>
>
>
>
>
>
>
>
>
>
>
>
>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.
> 
>

--
Perl is my reason for following the Sun;



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





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]
 




Regarding strings

2005-01-07 Thread arjun.mallik

Hi Frnds,
If I have a number of 6 digits. How to get the last 2 digits. This
should be valid even when i have 2 digits as input.
i.e If input is 991041 then output shud be 41
 if input is  41 then output shud be 41

May be junk and simple question but ..i need this ..please do respond..


Thanks in advance

Arjun

Deserve before you desire










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.

How to find a file in a directory structure

2004-12-07 Thread arjun.mallik

Hi Frnds,

I have to search for  a file in  a PATH  and then once the file is found
,  assign that full path of the that file to an environment variable.
and quit further searching.[because only full path of the first
occurance of the file is required]

PATH is defined like  --->
/etc/oms/perl:/var/tmp/disk:/tmp/docs/:/usr/bin

can u help me out ??

Thanks in advance

Arjun

Deserve before you desire










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.

problem with strings

2004-12-02 Thread arjun.mallik

Hi Frnds,
I have a problem with string passed as an argument to a perl script.

I am giving the string \"C:\\PROGRA~1\\INTERN~1\\IEXPLORE.EXE\"   as an
argument to the cmdtemplate option.
and it been taken as C:PROGRA~1INTERN~1IEXPLORE.EXE  after parsing it.

what happend to the back slash.??

In the perl script the parser code is like below
===
# Parse command line options

Getopt::Long::config( qw
  (
   no_ignore_case
  )) ;

GetOptions("gid=i" => \$GLOBALID,
   "context=s" => \$CONTEXT,

   "nesubtype:s"   => \$NESUBTYPE,
   "neversion:s"   => \$NEVERSION,

   "emplatform=s"  => \$EMPLATFORM,
   "emapptype=s"   => \$EMAPPTYPE,
   "emappserver:s" => \$EMAPPSERVER,

   "cmdtemplate=s" => \$CMDTEMPLATE,
  "v" => \$emicom::VERBOSE
  );
=

Please help me out..

Arjun

Deserve before you desire









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.

how to capture host name to a variable

2004-11-20 Thread arjun.mallik

Hi Frnds,
I need to capture the current system name to a variable. I am doing like
below but , the hostname value is not getting stored in the variable.
any suggestions please ??
-
$systemserver = system("hostname");
--

Thanks in advance
Arjun





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.

RE: Reg..Regular expression

2004-11-10 Thread arjun.mallik

Hi Frnds,
I found some solution for  my problem.

foreach $line2 (@objects)
  {
chomp($line2);
if ($line2 =~ /^\s*\(\s*ObjectClass\s*"(.+?)"\s*\)/)
  {
$var=$1;


Arjun


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 11, 2004 10:07 AM
To: [EMAIL PROTECTED]
Subject: Reg..Regular expression



Hi Frnds,
I need to extract a string from every line of a file which are present
in a array.

The string to be extracted is  present in between double quotes. I am
using below code and it is not working. == foreach
$line2 (@objects)
  {
chomp($line2); <--- To remove the new line at the end
print "Function been called and object is  $line2\n";
$var = /^\s*\(\s*ObjectClass\s*"(.+?)"\s*\)/;
 




Reg..Regular expression


Hi Frnds,
I need to extract a string from every line of a file which are present
in a array.
The string to be extracted is  present in between double quotes. I am
using below code and it is not working.
==
foreach $line2 (@objects)
  {
chomp($line2); <--- To remove the new line at the end
print "Function been called and object is  $line2\n";
$var = /^\s*\(\s*ObjectClass\s*"(.+?)"\s*\)/;


RE: how to append test to file


Hi Frnds,
I myself found some way.Read the file to an array and created a file as
per requirement and then inserted the objects in the array to file.

for ($i=0;$i < $#arr;$i++)
{
  print OUTPUT $arr[$i];
}
=

Arjun


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 09, 2004 2:31 PM
To: [EMAIL PROTECTED]
Subject: RE: how to append test to file



Hi ,
Can any suggest some thing for my problem, like I need to append to a
file from last but one line of the  existing file.
Ex: if  a file has 6 lines then appending should be done from 6th
line


Thanks in advance
Arjun


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

Sent: Monday, November 08, 2004 8:24 PM
To: [EMAIL PROTECTED]
Subject: how to append test to file



Hi ,


there is an existing file and I need to append  text to it ,only thing
is I need to remove the last line of existing file and then need to
append text. I hope I am  clear.If there are 6 lines in a file I have
remove 6th line and then need to append the text.






Thanks in advance
Arjun







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.


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]
 





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]
 




RE: how to append test to file


Hi ,
Can any suggest some thing for my problem, like I need to append to a
file from last but one line of the  existing file.
Ex: if  a file has 6 lines then appending should be done from 6th
line


Thanks in advance
Arjun


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, November 08, 2004 8:24 PM
To: [EMAIL PROTECTED]
Subject: how to append test to file



Hi ,


there is an existing file and I need to append  text to it ,only thing
is I need to remove the last line of existing file and then need to
append text. I hope I am  clear.If there are 6 lines in a file I have
remove 6th line and then need to append the text.






Thanks in advance
Arjun







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.


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]
 




how to append test to file


Hi ,

there is an existing file and I need to append  text to it ,only thing
is I need to remove the last line of existing file and then need to
append text.
I hope I am  clear.If there are 6 lines in a file I have remove 6th line
and then need to append the text.



Thanks in advance
Arjun





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.

How to get text after comment


Hi,
I need to capture whole text after "#" character in each line from  a
file.The below script is not working can any one suggest the correct
thing plz..


chomp($line1);
 if ($line1 =~ /^#\(.*\)/)
   {
#Hash array will remove the duplicates entries of objects
present if any,
#OBJECT is a dummy value used to manage key,value pair
 
$objectsHash{$1} = 'OBJECT';
   }
==

Thanks in advance
Arjun





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.

RE: Newbie: Perl Vs Shell


Shell scripting is native to the shell in which u right them and are not
portable  more imp is difficult to implement even simple logic ..but are
very fast as they are native to OS.

,where as  Perl scripts are inter operable and a bit easy to write and
debug] compared to shell scripts.

This as per my under standing

Arjun


-Original Message-
From: Durai raj [mailto:[EMAIL PROTECTED]
Sent: Friday, October 29, 2004 3:01 PM
To: [EMAIL PROTECTED]
Subject: Newbie: Perl Vs Shell


Hello All,

  Anyone can explain the difference between Perl and Shell scripts?

Regards,
Durai.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.783 / Virus Database: 529 - Release Date: 10/27/2004


-
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.



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]
 




RE: Append on top


This mode will append text at the bottom not at the top.

Arjun


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Friday, October 29, 2004 2:45 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Append on top


open(MYNAME,">>a.txt");


-Original Message-
From: Rajesh Dorairajan [mailto:[EMAIL PROTECTED]
Sent: 29 October 2004 02:12
To: Perl-Beginners ([EMAIL PROTECTED])
Cc: Rajesh Dorairajan
Subject: Append on top


Does anyone know of a way to open a file in append mode and append on
top of the file?

Thanks in Advance,

--Rajesh

Visit our website at http://www.ubs.com

This message contains confidential information and is intended only
for the individual named.  If you are not the named addressee you
should not disseminate, distribute or copy this e-mail.  Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.  The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission.  If
verification is required please request a hard-copy version.  This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.


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





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]
 




Creation of file


Hi ,
How to create a file with write permission to all users.It is now over
! it should be possible even the file exists and should not matter
what are the existing permissions.
and who ever may be the owner.
Finally file should be with 666 permissions.
I have tried umask it was not working ,if chmod is used and owner
conflict  is coming.

Help is appreciated ..

thanks in advance
Arjun





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.

RE: Line replace


Hai !
Open the file with any file handler and use regular expression.. This
way it will work.



Open (File handler name ,">>file name");

While ( $string=)
{
   if ( $string = ~ /^Alpha\(a,b,c\)/ )
   {
   $string = "#" . $string ;
   print$string ;
   }
}


Arjun

-Original Message-
From: Urs Wagner [mailto:[EMAIL PROTECTED]
Sent: Monday, October 11, 2004 4:24 PM
To: [EMAIL PROTECTED]
Subject: Line replace


Hello

I should comment out lines in a text file. I have a lot of troubles to
realize this.

The lines
Alpha(a, b, c)
should be changed to
# Alpha(a, b, c)

What I would like to write is a small perl script to make this
convetion.

Thanks

Urs

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





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]
 




RE: Line replace


Good one liner I appreciate it ..

Arjun


-Original Message-
From: Ramprasad A Padmanabhan [mailto:[EMAIL PROTECTED]
Sent: Monday, October 11, 2004 4:41 PM
To: Urs Wagner
Cc: perl beginners
Subject: Re: Line replace


On Mon, 2004-10-11 at 16:23, Urs Wagner wrote:
> Hello
>
> I should comment out lines in a text file. I have a lot of troubles to
> realize this.
>
> The lines
> Alpha(a, b, c)
> should be changed to
> # Alpha(a, b, c)
>


perl -pli.BAK -e 's/(?=.*Alpha\(a, b ,c\))/#/' FILENAME

HTH
Ram



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




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]
 




RE: how to open a file with 666 permission


Hey guys !
Thanks for the support .the following is the code I have written.
Working fine.

===
open(LOG,">$main::TRACELOGFILE") or die "Can't open trace file
$main::TRACELOGFILE";
 system("chown XXX:Y  $main::TRACELOGFILE");
 system("chmod 0666 $main::TRACELOGFILE");


Arjun


-Original Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 29, 2004 6:16 PM
To: Perl Beginners
Subject: Re: how to open a file with 666 permission


Bob Showalter wrote:
> [EMAIL PROTECTED] wrote:
>
>>My requirement is to open file with 666 permissions.
>
> You need to set umask to 0 before creating the file.
>
> But don't do that. It's inadvisable to mess with the umask in a
> program, IMO. If the user wants to create files as 666, let him set
> the umask before running your program.

Or use chmod() on the file to set whatever permissions you desire.


John
--
use Perl;
program
fulfillment

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




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]
 




how to open a file with 666 permission


Hai!
My requirement is to open file with 666 permissions.[If fine doesn't
exists it should get created ].Iam doing as below,is this ok.

===
sysopen(LOG,"$main::TRACELOGFILE",O_CREATE,0666) or die "Can't open
trace file $main::TRACELOGFILE";


ami doing any thing wrong ,if yes correct me.If file is created once it
is working fine.For the first time it is giving below error
===
Can't open trace file /var/opt/X/log/X08013.log
==


Arjun






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.