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:

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

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.

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

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.

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

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);

RE: query about hash

2005-07-16 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

RE: 0; and 1;

2005-07-15 Thread arjun.mallik
Hi , I have executed a Perl script from csh[c shell ] and saw that exit number 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 number; Stands for. Any one can help here ... please Thanks in

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

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 [

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

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 value1 -param2 value2 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

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

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

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

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

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

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

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

Reg..Regular expression

2004-11-10 Thread arjun.mallik
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

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-

RE: how to append test to file

2004-11-09 Thread arjun.mallik
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

RE: how to append test to file

2004-11-09 Thread arjun.mallik
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

How to get text after comment

2004-11-08 Thread arjun.mallik
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

how to append test to file

2004-11-08 Thread arjun.mallik
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

RE: Append on top

2004-10-29 Thread arjun.mallik
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

RE: Newbie: Perl Vs Shell

2004-10-29 Thread arjun.mallik
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

Creation of file

2004-10-14 Thread arjun.mallik
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

RE: Line replace

2004-10-11 Thread arjun.mallik
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

RE: Line replace

2004-10-11 Thread arjun.mallik
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=filehandler) { if ( $string = ~ /^Alpha\(a,b,c\)/ ) { $string = # . $string ; print file handler $string ; } } Arjun

how to open a file with 666 permission

2004-09-29 Thread arjun.mallik
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

RE: how to open a file with 666 permission

2004-09-29 Thread arjun.mallik
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);