help in while loop

2008-03-17 Thread Irfan.Sayed
Hi All,

 

Can somebody please let me know the meaning of this line.

 

while (<$in>)

{

if(/,/) {print "before match: $`\t and after match: $'\n\n";}; $x=$';
$y=$`; &mysubroutine($x,$y);

 

}

 

I know it is a while loop for the file handle ($in) and it will be
executed till the end of file but not getting the meaning of if loop. 

 

What this if loop actually does. Please help

 

Regards,

Irfan

 



diff of two files

2008-03-17 Thread Irfan.Sayed
Hi All,

 

I want to compare the two files in Perl. The requirement is that file 1
has 20 lines and file2 has 25 lines . I want to see only five lines as
output which are there in file2 not in file1 as I know that rest of the
20 lines are same in both the files.

I am using the following commands 

 

Diff /tmp/dev_path_PRS.DB.01.12.000 /tmp/dep_path_D.PRS.DB.01.12.000.8

 

As per my understating I should get 5 lines as output

 

Could you please help in getting exact result.

 

Please help

 

Regards,

Irfan

 



RE: diff of two files

2008-03-20 Thread Irfan.Sayed
Hi All,

Can somebody please help me on this???

Regards,
Irfan


-Original Message-
From: Sayed, Irfan 
Sent: Monday, March 17, 2008 7:52 PM
To: beginners@perl.org
Subject: diff of two files

Hi All,

 

I want to compare the two files in Perl. The requirement is that file 1
has 20 lines and file2 has 25 lines . I want to see only five lines as
output which are there in file2 not in file1 as I know that rest of the
20 lines are same in both the files.

I am using the following commands 

 

Diff /tmp/dev_path_PRS.DB.01.12.000 /tmp/dep_path_D.PRS.DB.01.12.000.8

 

As per my understating I should get 5 lines as output

 

Could you please help in getting exact result.

 

Please help

 

Regards,

Irfan

 


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




RE: diff of two files

2008-03-24 Thread Irfan.Sayed
No it is not a homework. It's a official script which I want to make it
into production???

Please help.

Regards,
Irfan


-Original Message-
From: Ken Foskey [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 20, 2008 1:48 PM
To: beginners@perl.org
Subject: RE: diff of two files

Sounds like homework not a genuine work query.

On Thu, 2008-03-20 at 15:14 +0530, [EMAIL PROTECTED] wrote:
> Hi All,
> 
> Can somebody please help me on this???
> 
> Regards,
> Irfan
> 
> 
> -Original Message-
> From: Sayed, Irfan 
> Sent: Monday, March 17, 2008 7:52 PM
> To: beginners@perl.org
> Subject: diff of two files
> 
> Hi All,
> 
>  
> 
> I want to compare the two files in Perl. The requirement is that file
1
> has 20 lines and file2 has 25 lines . I want to see only five lines as
> output which are there in file2 not in file1 as I know that rest of
the
> 20 lines are same in both the files.
> 
> I am using the following commands 
> 
>  
> 
> Diff /tmp/dev_path_PRS.DB.01.12.000 /tmp/dep_path_D.PRS.DB.01.12.000.8
> 
>  
> 
> As per my understating I should get 5 lines as output
> 
>  
> 
> Could you please help in getting exact result.
> 
>  
> 
> Please help
> 
>  
> 
> Regards,
> 
> Irfan
> 

Here is a micro spec,  if you show your perl code you might get help.

If you want unique lines simply sort the two input files and read them
together.  if the records match then read another pair,  if they don't
then output the lesser value of the two,  read appropriate file and
retry.

Good luck
Ken


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



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




reg ex

2008-04-15 Thread Irfan.Sayed
Hi All,

 

I need help in regular expression. I have string as follows.

 

OMS.FD.08.03.000.14

 

I need only OMS.FD.08.03.000 this much part of the string.i want to
exclude .14

 

Please help.

 

Regards,

Irfan

 



setting unix command through perl script

2008-04-16 Thread Irfan.Sayed
Hi All,

 

I need to execute the "export CCASE_NO_FILE_HEADER=yes" command through
Perl script.

 

What I did is qx(export CCASE_NO_FILE_HEADER=yes); but still the value
for CCASE_NO_FILE_HEADER is not getting set to "yes"

 

Regards,

Irfan

 



RE: setting unix command through perl script

2008-04-16 Thread Irfan.Sayed
I tried the line : $ENV{CCASE_NO_FILE_HEADER} = 'yes';

But still the value is not getting set.

Please help.

Regards,
Irfan

Project Lead
TSINDIA - Production Line
Individual Software Solutions - UMO
T-Systems India Private Limited, Pune
Telephone: +91-20-30245000/25605000 (Extn: 5271) 
Mobile: +91 9822 854 227
Fax: +91-020 25674090
Internet: http://www.t-systems.com


-Original Message-
From: Rodrick Brown [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 16, 2008 5:04 PM
To: Sayed, Irfan
Cc: beginners@perl.org
Subject: Re: setting unix command through perl script

On Wed, Apr 16, 2008 at 7:05 AM,  <[EMAIL PROTECTED]> wrote:
> Hi All,
>
>
>
>  I need to execute the "export CCASE_NO_FILE_HEADER=yes" command through
>  Perl script.
>
>
>
>  What I did is qx(export CCASE_NO_FILE_HEADER=yes); but still the value
>  for CCASE_NO_FILE_HEADER is not getting set to "yes"
>
>
>
>  Regards,
>
>  Irfan
>
>
>
>

With Perl you can get and set environment variables through using %ENV
ie. $ENV{FOO} = 'bar'

-- 
[ Rodrick R. Brown ]
http://www.rodrickbrown.com
http://www.linkedin.com/in/rodrickbrown

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




log for script

2008-04-16 Thread Irfan.Sayed
Hi All,

 

Is there any mechanism where I can take the log of entire Perl script. I
mean to say that I need the log of each and every step which I am doing
in Perl script. That step may include 

1: input from user

2: internal Perl script commands

 

Ultimately whatever Perl script is doing , I should know.

 

Is there any way. Please help.

 

Regards,

Irfan

 



RE: setting unix command through perl script

2008-04-17 Thread Irfan.Sayed
I want to execute "export CCASE_NO_FILE_HEADER=yes" command in Perl
script.
If I run this command on bash prompt then it is executing properly but
if I try to execute this command through perl script then it is not
executing at all

How should I achieve this . is there any another way.

Please help.

Regards,
Irfan

-Original Message-
From: Kenneth Wolcott [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 17, 2008 12:05 AM
To: beginners@perl.org
Subject: Fwd: setting unix command through perl script

Oops -- did reply and instead of reply-all :-(

-- Forwarded message --
From: Kenneth Wolcott <[EMAIL PROTECTED]>
Date: Wed, Apr 16, 2008 at 11:33 AM
Subject: Re: setting unix command through perl script
To: [EMAIL PROTECTED]


Agreed that the parent process in which perl was invoked will not be
changed
by the perl script.

What is the overall objective?

Try to do everything you need to do inside the perl script, or
everything
you need to do outside the perl script.

HTH,
Ken Wolcott


On Wed, Apr 16, 2008 at 5:31 AM, Martin Barth <[EMAIL PROTECTED]> wrote:

> i think this is not possible.
>
> if you start a new process (shell) it gets the environment of its
parent
> process. but if you manipulate the environment in a child the parent
will
> not notice this..
>
> for example
>
> $ bash
> $ export FOO=BAR
> $ echo $FOO
> BAR
> $ exit
> $ echo $FOO
>
>
> Regards Martin
>
>
> On 14:20:18 16/04/2008 <[EMAIL PROTECTED]> wrote:
> > I tried the line : $ENV{CCASE_NO_FILE_HEADER} = 'yes';
> >
> > But still the value is not getting set.
> >
> > Please help.
> >
> > Regards,
> > Irfan
> >
> > Project Lead
> > TSINDIA - Production Line
> > Individual Software Solutions - UMO
> > T-Systems India Private Limited, Pune
> > Telephone: +91-20-30245000/25605000 (Extn: 5271)
> > Mobile: +91 9822 854 227
> > Fax: +91-020 25674090
> > Internet: http://www.t-systems.com
> >
> >
> > -Original Message-
> > From: Rodrick Brown [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, April 16, 2008 5:04 PM
> > To: Sayed, Irfan
> > Cc: beginners@perl.org
> > Subject: Re: setting unix command through perl script
> >
> > On Wed, Apr 16, 2008 at 7:05 AM,  <[EMAIL PROTECTED]> wrote:
> > >  Hi All,
> > >
> > >
> > >
> > >   I need to execute the "export CCASE_NO_FILE_HEADER=yes" command
> > >   through Perl script.
> > >
> > >
> > >
> > >   What I did is qx(export CCASE_NO_FILE_HEADER=yes); but still the
> > >   value for CCASE_NO_FILE_HEADER is not getting set to "yes"
> > >
> > >
> > >
> > >   Regards,
> > >
> > >   Irfan
> > >
> > >
> > >
> > >
> >
> > With Perl you can get and set environment variables through using
%ENV
> > ie. $ENV{FOO} = 'bar'
> >
> > --
> > [ Rodrick R. Brown ]
> > http://www.rodrickbrown.com
> > http://www.linkedin.com/in/rodrickbrown
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > http://learn.perl.org/
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>

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




RE: setting unix command through perl script

2008-04-17 Thread Irfan.Sayed
Hi,

OK. Thanks.

IS there any other mechanism to achieve this??

Regards,
Irfan

-Original Message-
From: Martin Barth [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 17, 2008 1:01 PM
To: beginners@perl.org
Subject: RE: setting unix command through perl script

Hi

your "command" is executed. it changes the environment of the shell you
spawn with qx(); but after this statement your shell dies and it seems
that
nothing happend..

it is simply impossible to change the environment of a parent when
you're a
child.

maybe you can add this line to your shell configuration file.
(.bash_profile or .zshrc ...)

Regards Martin

On 9:05:15 17/04/2008 <[EMAIL PROTECTED]> wrote:
> I want to execute "export CCASE_NO_FILE_HEADER=yes" command in Perl
> script.
> If I run this command on bash prompt then it is executing properly but
> if I try to execute this command through perl script then it is not
> executing at all
>
> How should I achieve this . is there any another way.
>
> Please help.
>
> Regards,
> Irfan
>
> -Original Message-
> From: Kenneth Wolcott [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 17, 2008 12:05 AM
> To: beginners@perl.org
> Subject: Fwd: setting unix command through perl script
>
> Oops -- did reply and instead of reply-all :-(
>
> -- Forwarded message --
> From: Kenneth Wolcott <[EMAIL PROTECTED]>
> Date: Wed, Apr 16, 2008 at 11:33 AM
> Subject: Re: setting unix command through perl script
> To: [EMAIL PROTECTED]
>
>
> Agreed that the parent process in which perl was invoked will not be
> changed
> by the perl script.
>
> What is the overall objective?
>
> Try to do everything you need to do inside the perl script, or
> everything
> you need to do outside the perl script.
>
> HTH,
> Ken Wolcott
>
>
> On Wed, Apr 16, 2008 at 5:31 AM, Martin Barth <[EMAIL PROTECTED]>
> wrote:
>
> >  i think this is not possible.
> >
> >  if you start a new process (shell) it gets the environment of its
> parent
> >  process. but if you manipulate the environment in a child the
> parent will
> >  not notice this..
> >
> >  for example
> >
> >  $ bash
> >  $ export FOO=BAR
> >  $ echo $FOO
> >  BAR
> >  $ exit
> >  $ echo $FOO
> >
> >
> >  Regards Martin
> >
> >
> >  On 14:20:18 16/04/2008 <[EMAIL PROTECTED]> wrote:
> > >  I tried the line : $ENV{CCASE_NO_FILE_HEADER} = 'yes';
> > >
> > >  But still the value is not getting set.
> > >
> > >  Please help.
> > >
> > >  Regards,
> > >  Irfan
> > >
> > >  Project Lead
> > >  TSINDIA - Production Line
> > >  Individual Software Solutions - UMO
> > >  T-Systems India Private Limited, Pune
> > >  Telephone: +91-20-30245000/25605000 (Extn: 5271)
> > >  Mobile: +91 9822 854 227
> > >  Fax: +91-020 25674090
> > >  Internet: http://www.t-systems.com
> > >
> > >
> > >  -Original Message-
> > >  From: Rodrick Brown [mailto:[EMAIL PROTECTED]
> > >  Sent: Wednesday, April 16, 2008 5:04 PM
> > >  To: Sayed, Irfan
> > >  Cc: beginners@perl.org
> > >  Subject: Re: setting unix command through perl script
> > >
> > >  On Wed, Apr 16, 2008 at 7:05 AM,  <[EMAIL PROTECTED]>
> > > >   wrote: Hi All,
> > > >
> > > >
> > > >
> > > >I need to execute the "export CCASE_NO_FILE_HEADER=yes"
> > > >command through Perl script.
> > > >
> > > >
> > > >
> > > >What I did is qx(export CCASE_NO_FILE_HEADER=yes); but still
> > > >the value for CCASE_NO_FILE_HEADER is not getting set to
> > > > "yes"
> > > >
> > > >
> > > >Regards,
> > > >
> > > >Irfan
> > > >
> > > >
> > > >
> > > >
> > >
> > >  With Perl you can get and set environment variables through using
> %ENV
> > >  ie. $ENV{FOO} = 'bar'
> > >
> > >  --
> > >  [ Rodrick R. Brown ]
> > >  http://www.rodrickbrown.com
> > >  http://www.linkedin.com/in/rodrickbrown
> > >
> > >  --
> > >  To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >  For additional commands, e-mail: [EMAIL PROTECTED]
> > >  http://learn.perl.org/
> >
> >
> >  --
> >  To unsubscribe, e-mail: [EMAIL PROTECTED]
> >  For additional commands, e-mail: [EMAIL PROTECTED]
> >  http://learn.perl.org/
> >
> >
> >
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/


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



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




RE: setting unix command through perl script

2008-04-17 Thread Irfan.Sayed
Thanks for your help.

Actually , I am automating one task in Perl in which this command is
there. If I don't execute this command then entire task would fail.
So it's very important that I should set this variable with proper value
and then start the execution of the task.

Regards,
Irfan


-Original Message-
From: Martin Barth [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 17, 2008 3:02 PM
To: beginners@perl.org
Subject: RE: setting unix command through perl script

Hi,

maybe yes. why do you need this variable to be set/changed? tell us some
more about your objectives, please.

Regards Martin

On 11:25:01 17/04/2008 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> OK. Thanks.
>
> IS there any other mechanism to achieve this??
>
> Regards,
> Irfan
>
> -Original Message-
> From: Martin Barth [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 17, 2008 1:01 PM
> To: beginners@perl.org
> Subject: RE: setting unix command through perl script
>
> Hi
>
> your "command" is executed. it changes the environment of the shell
> you spawn with qx(); but after this statement your shell dies and it
> seems that
> nothing happend..
>
> it is simply impossible to change the environment of a parent when
> you're a
> child.
>
> maybe you can add this line to your shell configuration file.
> (.bash_profile or .zshrc ...)
>
> Regards Martin
>
> On 9:05:15 17/04/2008 <[EMAIL PROTECTED]> wrote:
> >  I want to execute "export CCASE_NO_FILE_HEADER=yes" command in Perl
> >  script.
> >  If I run this command on bash prompt then it is executing properly
> >  but if I try to execute this command through perl script then it
> >  is not executing at all
> >
> >  How should I achieve this . is there any another way.
> >
> >  Please help.
> >
> >  Regards,
> >  Irfan
> >
> >  -Original Message-
> >  From: Kenneth Wolcott [mailto:[EMAIL PROTECTED]
> >  Sent: Thursday, April 17, 2008 12:05 AM
> >  To: beginners@perl.org
> >  Subject: Fwd: setting unix command through perl script
> >
> >  Oops -- did reply and instead of reply-all :-(
> >
> >  -- Forwarded message --
> >  From: Kenneth Wolcott <[EMAIL PROTECTED]>
> >  Date: Wed, Apr 16, 2008 at 11:33 AM
> >  Subject: Re: setting unix command through perl script
> >  To: [EMAIL PROTECTED]
> >
> >
> >  Agreed that the parent process in which perl was invoked will not
> >  be changed
> >  by the perl script.
> >
> >  What is the overall objective?
> >
> >  Try to do everything you need to do inside the perl script, or
> >  everything
> >  you need to do outside the perl script.
> >
> >  HTH,
> >  Ken Wolcott
> >
> >
> >  On Wed, Apr 16, 2008 at 5:31 AM, Martin Barth <[EMAIL PROTECTED]>
> >  wrote:
> >
> > >   i think this is not possible.
> > >
> > >   if you start a new process (shell) it gets the environment of
> >  its parent
> > >   process. but if you manipulate the environment in a child the
> >  parent will
> > >   not notice this..
> > >
> > >   for example
> > >
> > >   $ bash
> > >   $ export FOO=BAR
> > >   $ echo $FOO
> > >   BAR
> > >   $ exit
> > >   $ echo $FOO
> > >
> > >
> > >   Regards Martin
> > >
> > >
> > >   On 14:20:18 16/04/2008 <[EMAIL PROTECTED]> wrote:
> > > >   I tried the line : $ENV{CCASE_NO_FILE_HEADER} = 'yes';
> > > >
> > > >   But still the value is not getting set.
> > > >
> > > >   Please help.
> > > >
> > > >   Regards,
> > > >   Irfan
> > > >
> > > >   Project Lead
> > > >   TSINDIA - Production Line
> > > >   Individual Software Solutions - UMO
> > > >   T-Systems India Private Limited, Pune
> > > >   Telephone: +91-20-30245000/25605000 (Extn: 5271)
> > > >   Mobile: +91 9822 854 227
> > > >   Fax: +91-020 25674090
> > > >   Internet: http://www.t-systems.com
> > > >
> > > >
> > > >   -Original Message-
> > > >   From: Rodrick Brown [mailto:[EMAIL PROTECTED]
> > > >   Sent: Wednesday, April 16, 2008 5:04 PM
> > > >   To: Sayed, Irfan
> > > >   Cc: beginners@perl.org
> > > >   Subject: Re: setting unix command through perl script
> > > >
> > > >   On Wed, Apr 16, 2008 at 7:05 AM,  <[EMAIL PROTECTED]>
> > > > >wrote: Hi All,
> > > > >
> > > > >
> > > > >
> > > > > I need to execute the "export CCASE_NO_FILE_HEADER=yes"
> > > > > command through Perl script.
> > > > >
> > > > >
> > > > >
> > > > > What I did is qx(export CCASE_NO_FILE_HEADER=yes); but
> > > > > still the value for CCASE_NO_FILE_HEADER is not getting
> > > > >  set to "yes"
> > > > >
> > > > >
> > > > > Regards,
> > > > >
> > > > > Irfan
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >   With Perl you can get and set environment variables through
> >  using %ENV
> > > >   ie. $ENV{FOO} = 'bar'
> > > >
> > > >   --
> > > >   [ Rodrick R. Brown ]
> > > >   http://www.rodrickbrown.com
> > > >   http://www.linkedin.com/in/rodrickbrown
> > > >
> > > >   --
> > > >   To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > >   For additional commands, e-mail: [EMAIL PROTECTED]
> > > >   http://learn.perl.org/
> > >
> > >
> > >   --
> 

RE: setting unix command through perl script

2008-04-17 Thread Irfan.Sayed
Thanks for your reply.

I have run the command like this

-> qx(CCASE_NO_FILE_HEADER=yes perl /home/m.belgaonkar/merge_latest.pl)
bash: syntax error near unexpected token `qx(CCASE_NO_FILE_HEADER=yes'
[EMAIL PROTECTED] ():/view/m.belgaonkar_oms_test/vob/oms [320]

Please help.

Regards,
Irfan

Project Lead
TSINDIA - Production Line
Individual Software Solutions - UMO
T-Systems India Private Limited, Pune
Telephone: +91-20-30245000/25605000 (Extn: 5271) 
Mobile: +91 9822 854 227
Fax: +91-020 25674090
Internet: http://www.t-systems.com


-Original Message-
From: Martin Barth [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 17, 2008 4:42 PM
To: beginners@perl.org
Subject: RE: setting unix command through perl script

hi,

you could do something like that:

qx(CCASE_NO_FILE_HEADER=yes /path/to/your/task);

this would set the variable only for this task.

HTH,
Martin

On 11:48:35 17/04/2008 <[EMAIL PROTECTED]> wrote:
> Thanks for your help.
>
> Actually , I am automating one task in Perl in which this command is
> there. If I don't execute this command then entire task would fail.
> So it's very important that I should set this variable with proper
> value and then start the execution of the task.
>
> Regards,
> Irfan
>
>
> -Original Message-
> From: Martin Barth [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 17, 2008 3:02 PM
> To: beginners@perl.org
> Subject: RE: setting unix command through perl script
>
> Hi,
>
> maybe yes. why do you need this variable to be set/changed? tell us
> some more about your objectives, please.
>
> Regards Martin
>
> On 11:25:01 17/04/2008 <[EMAIL PROTECTED]> wrote:
> >  Hi,
> >
> >  OK. Thanks.
> >
> >  IS there any other mechanism to achieve this??
> >
> >  Regards,
> >  Irfan
> >
> >  -Original Message-
> >  From: Martin Barth [mailto:[EMAIL PROTECTED]
> >  Sent: Thursday, April 17, 2008 1:01 PM
> >  To: beginners@perl.org
> >  Subject: RE: setting unix command through perl script
> >
> >  Hi
> >
> >  your "command" is executed. it changes the environment of the shell
> >  you spawn with qx(); but after this statement your shell dies and
> >  it seems that
> >  nothing happend..
> >
> >  it is simply impossible to change the environment of a parent when
> >  you're a
> >  child.
> >
> >  maybe you can add this line to your shell configuration file.
> >  (.bash_profile or .zshrc ...)
> >
> >  Regards Martin
> >
> >  On 9:05:15 17/04/2008 <[EMAIL PROTECTED]> wrote:
> > >   I want to execute "export CCASE_NO_FILE_HEADER=yes" command in
> > >   Perl script.
> > >   If I run this command on bash prompt then it is executing
> > >   properly but if I try to execute this command through perl
> > >   script then it is not executing at all
> > >
> > >   How should I achieve this . is there any another way.
> > >
> > >   Please help.
> > >
> > >   Regards,
> > >   Irfan
> > >
> > >   -Original Message-
> > >   From: Kenneth Wolcott [mailto:[EMAIL PROTECTED]
> > >   Sent: Thursday, April 17, 2008 12:05 AM
> > >   To: beginners@perl.org
> > >   Subject: Fwd: setting unix command through perl script
> > >
> > >   Oops -- did reply and instead of reply-all :-(
> > >
> > >   -- Forwarded message --
> > >   From: Kenneth Wolcott <[EMAIL PROTECTED]>
> > >   Date: Wed, Apr 16, 2008 at 11:33 AM
> > >   Subject: Re: setting unix command through perl script
> > >   To: [EMAIL PROTECTED]
> > >
> > >
> > >   Agreed that the parent process in which perl was invoked will
> > >   not be changed
> > >   by the perl script.
> > >
> > >   What is the overall objective?
> > >
> > >   Try to do everything you need to do inside the perl script, or
> > >   everything
> > >   you need to do outside the perl script.
> > >
> > >   HTH,
> > >   Ken Wolcott
> > >
> > >
> > >   On Wed, Apr 16, 2008 at 5:31 AM, Martin Barth
> > >   <[EMAIL PROTECTED]> wrote:
> > >
> > > >i think this is not possible.
> > > >
> > > >if you start a new process (shell) it gets the environment of
> > >   its parent
> > > >process. but if you manipulate the environment in a child the
> > >   parent will
> > > >not notice this..
> > > >
> > > >for example
> > > >
> > > >$ bash
> > > >$ export FOO=BAR
> > > >$ echo $FOO
> > > >BAR
> > > >$ exit
> > > >$ echo $FOO
> > > >
> > > >
> > > >Regards Martin
> > > >
> > > >
> > > >On 14:20:18 16/04/2008 <[EMAIL PROTECTED]> wrote:
> > > > >I tried the line : $ENV{CCASE_NO_FILE_HEADER} = 'yes';
> > > > >
> > > > >But still the value is not getting set.
> > > > >
> > > > >Please help.
> > > > >
> > > > >Regards,
> > > > >Irfan
> > > > >
> > > > >Project Lead
> > > > >TSINDIA - Production Line
> > > > >Individual Software Solutions - UMO
> > > > >T-Systems India Private Limited, Pune
> > > > >Telephone: +91-20-30245000/25605000 (Extn: 5271)
> > > > >Mobile: +91 9822 854 227
> > > > >Fax: +91-020 25674090
> > > > >Internet: http://www.t-systems.co

help in reg. exp.

2008-04-21 Thread Irfan.Sayed
Hi All,

 

I have string like OMS.FD.08.03.000.0 Now my req. is that if the string
contains .0 at the end then I want to remove that .0 but if any other
digit is there other than .0 then don't do anything.

 

For example: if string is : OMS.FD.08.03.000.0 then regular expression
should give OMS.FD.08.03.000

 

But if string is : OMS.FD.08.03.000.18 then don't do anything 

 

Please help.

 

Regards,

Irfan

 



how to check null value

2008-04-22 Thread Irfan.Sayed
Hi All,

 

How to find out whether the string contains null values or empty data.

 

For example : I have one scalar variable $str and now I want to check
whether it contains any data or not.

 

What I did  : If ($str eq "NULL" || $str eq " "){ print $str conatins
nothing\n";}

 

Is this correct?? Because doing as per above code , I am not getting
proper result.

 

Please help

 

Regards,

Irfan

 



Deletion of lines in file using perl

2008-04-23 Thread Irfan.Sayed
Hi All,

 

I need to delete some lines in file using Perl. The requirement is that
I have one file which contains following lines.

 

Element * checkdout

Element * latest.

 

And now I want to delete these lines using Perl script. 

 

Please help.

 

Regards,

Irfan

 



Log error

2008-05-12 Thread Irfan.Sayed
Hi All,

 

I have written once Perl script to perform certain task. In that script
I have defined one function to create the log file.

 

The issue is that whenever I am running that script it is executing fine
but the moment it reaches to log () function it throws me following
error.

 

Can't take log of 0 at /usr/tools/deployment/scripts/merge line 392,
 line 6

 

Entire Perl script has been attached for your reference.

 

Please help.

 

Regards,

Irfan

 

#! /usr/tools/deployment/bin/perl

use lib "/home/m.belgaonkar/";
use lib "/home/p.gupta/";
$i=0;
$p=0;
$l=0;
$dt=qx(date);
@dt1=split(' ',$dt);
@[EMAIL PROTECTED];
@[EMAIL PROTECTED];
@[EMAIL PROTECTED];
@[EMAIL PROTECTED];
chomp($dt_fin=join(":",@dt2));

system ("clear");
print "$dt_fin\n";
print "\n";
print "**Merge Tool\n";

$ap_nm=`pwd`;
if ($ap_nm =~ /view/){print "You are in the view:$ap_nm\n";}else{print "You are 
not in any clearcase view \n"; exit 1;}
if ($ap_nm =~ /oms/)
{
 $ap_nm=oms;
 print "Application name:oms\n";
}
 elsif ($ap_nm =~ /akb/)
{
 $ap_nm=akb;
 print "Application name:akb\n";
}
 elsif ($ap_nm =~ /cia/)
{
 $ap_nm=cia;
 print "Application name:cia\n";
}
 elsif ($ap_nm =~ /crm/)
 {
 $ap_nm=crm;
 print "Application name:crm\n";
}
 elsif ($ap_nm =~ /dps/)
 {
 $ap_nm=dps;
 print "Application name:dps\n";
}
 elsif ($ap_nm =~ /hmy/)
 {
 $ap_nm=hmy;
 print "Application name:hmy\n";
}
 elsif ($ap_nm =~ /vss/)
{
 $ap_nm=vss;
 print "Application name:vss\n";
}
elsif ($ap_nm =~ /ccb/)
{
 $ap_nm=ccb;
 print "Application name:ccb\n";
}
elsif ($ap_nm =~ /wsp/)
{
 $ap_nm=wsp;
 print "Application name:wsp\n";
}
elsif ($ap_nm =~ /prs/)
{
 $ap_nm=prs;
 print "Application name:prs\n";
}
else
{
 print "You does not seems to be in any application\n";
 print "Exiting\n";
 exit 1;
}

config_spec_chk();
env();
 sub config_spec_chk()
 {
%hash = (
oms => 'oms.rel.02.23.000',
akb => 'akb.rel.01.00.000',
cia => 'ci1.rel.02.00.000',
crm => 'crm.rel.03.00.000',
dps => 'dps.rel.01.00.000',
hmy => 'hmy.rel.00.00.000',
vss => 'vss.int.00.00.000',
prs => 'prs.rel.01.09.000',
ccb => 'ccb.rel.01.02.000',
wsp => 'wsp.rel.00.00.000',
  );

 %hash_const = (
"element /vob/support/tools/deployment/repository" => '/main/LATEST',
"element /vob/lib/repository/..." => '/main/LATEST',
"element /vob/lib/rep_v1/..." => '/main/LATEST',
"element /vob/support/tools/deployment/packages/..." => '/main/LATEST',
"element /vob/lib/packages/..." => '/main/LATEST',
"element /vob/support/tools/deployment/specs/..." => 'CHECKEDOUT',
"element /vob/support/tools/deployment/specs/..." => '/main/LATEST',
"element /vob/support/tools/deployment/initfiles/..." => 'CHECKEDOUT',
"element /vob/support/tools/deployment/initfiles/..." => '/main/LATEST',
"element /vob/support/tools/deployment/relnotespecs/..." => 
'CHECKEDOUT',
"element /vob/support/tools/deployment/relnotespecs/..." => 
'/main/LATEST',
"element /vob/support/tools/deployment/mergespecs/..." => 'CHECKEDOUT',
"element /vob/support/tools/deployment/mergespecs/..." => 
'/main/LATEST',
"element /vob/support/tools/deployment/scripts/..." => '/main/LATEST',
"element /vob/support/tools/deployment/global_env_files/..." => 
'/main/LATEST',
"element -directory /vob/support/tools/deployment" => '/main/LATEST',
"element -directory /vob/support/tools" => '/main/LATEST',
"element -directory /vob/support" => '/main/LATEST',
"element -directory /vob/lib" => '/main/LATEST',
);

#qx(ct catcs | tee /home/m.belgaonkar/curr_conf_spec_$dt_fin);
 open(fh, ">/tmp/config") || die "Can't open file:\n";
 while (($key,$value)=each(%hash))
 {

  if (($key eq oms) && ($ap_nm =~ /oms/))
 {
  $rel_br=$value;
  print fh "element /vob/support/tools/deployment/specs/...  CHECKEDOUT\n";
  print fh "element /vob/support/tools/deployment/initfiles/...  CHECKEDOUT\n";
  print fh "element /vob/support/tools/deployment/relnotespecs/...  
CHECKEDOUT\n";
  print fh "element /vob/support/tools/deployment/mergespecs/...   
CHECKEDOUT\n";

  print fh "\n";

  foreach (keys %hash_const)
{
 print fh "$_$hash_const{$_}\n";
}

  print fh "\n";
  print fh "element * CHECKEDOUT\n";
  print fh "element * .../$value/LATEST\n";
  print fh "element * /main/0 -mkbranch $value\n";
}
 elsif (($key eq akb) && ($ap_nm =~/akb/))
 {
  $rel_br=$value;
  print fh "element /vob/support/tools/deployment/specs/...  CHECKEDOUT\n";
  print fh "element /vob/support/tools/deployment/initfiles/...  CHECKEDOUT\n";
  print fh "element /vob/support/tools/deployment/relnotespecs/...  
CHECKEDOUT\n";
  print fh "element /vob/support/tools/deployment/mergespecs/...   
CHECKEDOUT\n";

  print fh "\n";

  foreach

Argument for perl script

2008-06-19 Thread Irfan.Sayed
Hi All,

 

I am using @ARGV variable to record the argument passed to my Perl
script. Now the requirement is that if I don't pass any argument to Perl
script then it should show me following such output.

 

Perl ack

Usage:  ack

   -name

-pkg

-relno

 

-name, -pkg, -relno are the user friendly option which should be mapped
to the arguments passed to the Perl script.

So -name should take first argument -pkg should take second argument and
so on.

 

Please help how should I do that.

 

Regards

Irfan.

 



RE: Argument for perl script

2008-06-19 Thread Irfan.Sayed
Thanks a lot for all response.

Regards
Irfan.


-Original Message-
From: Mimi Cafe [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 19, 2008 6:34 PM
To: beginners@perl.org
Subject: Re: Argument for perl script

You may have to parse @ARGV manually depending on how arguments are
passed
to your script. For instance, if you script is run as follows:
perl ack --name foo --pkg bar -relno 1234
then @ARGV will contain "--name, foo, --pkg, bar, -relno, 1234," and you
will have to parse the list for the values you need.

On the other hand if the script is run: perl ack foo bar 1234
then @ARGV will be "foo, bar, 1234"

You should look at the GetOpt::Short or GetOpt::Long modules which are
part
of the standard perl library.

Try perldoc GetOpt::Long on your command line to view the module doc.

Mimi



contain different values


On 19/06/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
>
> Hi All,
>
>
>
> I am using @ARGV variable to record the argument passed to my Perl
> script. Now the requirement is that if I don't pass any argument to
Perl
> script then it should show me following such output.
>
>
>
> Perl ack
>
> Usage:  ack
>
>   -name
>
>-pkg
>
>-relno
>
>
>
> -name, -pkg, -relno are the user friendly option which should be
mapped
> to the arguments passed to the Perl script.
>
> So -name should take first argument -pkg should take second argument
and
> so on.
>
>
>
> Please help how should I do that.
>
>
>
> Regards
>
> Irfan.
>
>
>
>

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




function call help

2008-07-09 Thread Irfan.Sayed
Hi All,

 

I facing one issue in Perl script.  I am executing one command in Perl
script and taking the output of that command in one array.  Now I want
to execute some more commands on each value of the array.

 

But the problem is that I am passing each value of the array as a
argument to that function but somehow it is not taking that value.

 

The output of the perl script is:

 

bash-3.00# perl backup.pl

/vob/test

Locking VOB 0

cleartool: Error: Unrecognized command: "lock:0"

Locking of VOB 0 failed

 

Now what I want is I need value "/vob/test" instead of 0.

 

Please find the attached perl script.

 

Please help/guide me.

 

Regards

Sayed.

 



backup.pl
Description: backup.pl
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


RE: function call help

2008-07-09 Thread Irfan.Sayed
Hi,

Thanks for reply, but still the error is same. Following is script.

#! /usr/bin/perl

# Perl script to take the backup of critical clearcase data

@vob_lst=system("/usr/atria/bin/cleartool lsvob -s");

foreach $a (@vob_lst)
{
 lockvob($a);
}

 sub lockvob()
{
 local ($lockitem) = @_;
 print "Locking VOB:\t$lockitem\n";
 `/usr/atria/bin/cleartool lock vob:$lockitem`;
 if($?){print "Locking of VOB $lockitem failed\n";}
 else{print "Locking of VOB $lockitem done\n";
 }
}

Please please help.

Regards
Irfan.


-Original Message-
From: Stewart Anderson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 09, 2008 7:45 PM
To: Sayed, Irfan; beginners@perl.org
Cc: Stewart Anderson
Subject: RE: function call help

 

Lock is a perl function

 

http://perldoc.perl.org/functions/lock.html

 

 

 

#! /usr/bin/perl

 

# Perl script to take the backup of critical clearcase data

 

@vob_lst=(qw(test test1 test2));

 

 

foreach $a (@vob_lst) {

 lockvob($a);

}

 

 

 sub lockvob {

local ( $lockitem ) = @_ ; 

 print "Locking VOB:\t$lockitem \n";

 #`/usr/atria/bin/cleartool lock:$a`;

 #if($?){print "Locking of VOB $lock failed\n";}

 #else{print "Locking of VOB $lock done\n";

 #}

}

 

 

 

Stewart Anderson

Application Support Analyst 
Sky Network Services (SNS)

Extension: 7212
Direct Line: +44 (0) 20 7032 7212
Email: [EMAIL PROTECTED]

Support Team Email:  [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]>  

  _  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 09 July 2008 14:33
To: beginners@perl.org
Subject: function call help

 

Hi All,

 

I facing one issue in Perl script.  I am executing one command in Perl
script and taking the output of that command in one array.  Now I want
to execute some more commands on each value of the array.

 

But the problem is that I am passing each value of the array as a
argument to that function but somehow it is not taking that value.

 

The output of the perl script is:

 

bash-3.00# perl backup.pl

/vob/test

Locking VOB 0

cleartool: Error: Unrecognized command: "lock:0"

Locking of VOB 0 failed

 

Now what I want is I need value "/vob/test" instead of 0.

 

Please find the attached perl script.

 

Please help/guide me.

 

Regards

Sayed.

 

Information in this email including any attachments may be privileged,
confidential and is intended exclusively for the addressee. The views
expressed may not be official policy, but the personal views of the
originator. If you have received it in error, please notify the sender
by return e-mail and delete it from your system. You should not
reproduce, distribute, store, retransmit, use or disclose its contents
to anyone. Please note we reserve the right to monitor all e-mail
communication through our internal and external networks. SKY and the
SKY marks are trade marks of British Sky Broadcasting Group plc and are
used under licence. British Sky Broadcasting Limited (Registration No.
2906991), Sky Interactive Limited (Registration No. 3554332),
Sky-In-Home Service Limited (Registration No. 2067075) and Sky
Subscribers Services Limited (Registration No. 2340150) are direct or
indirect subsidiaries of British Sky Broadcasting Group plc
(Registration No. 2247735). All of the companies mentioned in this
paragraph are incorporated in England and Wales and share the same
registered office at Grant Way, Isleworth, Middlesex TW7 5QD.

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




test mail

2008-10-13 Thread Irfan.Sayed





This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly
prohibited and may be unlawful.

Regarding reg. exp.

2008-10-13 Thread Irfan.Sayed

Hi All,



I have a string and I need to parse that string to check whether it is
in required format or not. I have a Perl script which ask for user
input. I have mentioned in the Perl script that input should be in the
following format.



For example:-  1,2,3 OR 1 2 3



Which means that delimiter between these figures should be comma OR
space. No any other character. I need all users to adhere that and if
they not then they should exit.



Can somebody please give me reg. exp. which can be used to parse the
string and check whether comma OR space is there or not as a delimiter
and it should contain only numeric not alphabets.



Please suggest.



Regards,

Irf









This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly
prohibited and may be unlawful.

variable in perl

2008-10-14 Thread Irfan.Sayed

Hi All,



Can somebody please tell me what is the meaning of $^X .



Regards

Irf.



This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly
prohibited and may be unlawful.

RE: Regarding reg. exp.

2008-10-14 Thread Irfan.Sayed

But I don’t want to match 12,2, or 234432 53. I want to match whether string 
contains 1 2 OR 1,2 OR 1,2,3 OR 1 2 3 Or any such combinations.
And I think this reg. exp. is doing that job.

-Original Message-
From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 14, 2008 5:16 PM
To: Sayed, Irfan (Cognizant)
Cc: [EMAIL PROTECTED]; beginners@perl.org
Subject: Re: Regarding reg. exp.

[EMAIL PROTECTED] пишет:
> Because I want comma (,) exactly once
>
> -Original Message-
> From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, October 14, 2008 4:41 PM
> To: Sayed, Irfan (Cognizant)
> Cc: [EMAIL PROTECTED]; beginners@perl.org
> Subject: Re: Regarding reg. exp.
>
> [EMAIL PROTECTED] пишет:
>   
>> if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/)
>>
>> this what I did.
>>
>>   
>>
>> 
> Hi!
>
> Why have you used {1} quantifier?
>
>   
No, its not correct. if you mention for example \d this will match 
*single* digit.
Your regex will match 1,2 or 1 2, but *not*  12,2 or  234323  53

if ($trig_np =~ m/ \d+ [,\s] \d* /x)

is much more correct




This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message. 
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly 
prohibited and may be unlawful.


RE: Regarding reg. exp.

2008-10-14 Thread Irfan.Sayed

Thanks really

-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 14, 2008 6:31 PM
To: Perl Beginners
Cc: Sayed, Irfan (Cognizant)
Subject: Re: Regarding reg. exp.

[EMAIL PROTECTED] wrote:
> From: Rob Dixon [mailto:[EMAIL PROTECTED]
>> [EMAIL PROTECTED] wrote:
>>>
>>> I have a string and I need to parse that string to check whether it
is
>>> in required format or not. I have a Perl script which ask for user
>>> input. I have mentioned in the Perl script that input should be in
the
>>> following format.
>>>
>>> For example:-  1,2,3 OR 1 2 3
>>>
>>> Which means that delimiter between these figures should be comma OR
>>> space. No any other character. I need all users to adhere that and
if
>>> they not then they should exit.
>>>
>>> Can somebody please give me reg. exp. which can be used to parse the
>>> string and check whether comma OR space is there or not as a
delimiter
>>> and it should contain only numeric not alphabets.
>>
>> It is very draconian to require exactly one space or comma as
>> separators. However this will do what you ask.
>>
>> Rob
>>
>>
>> use strict;
>> use warnings;
>>
>> my $re = qr/^
>>   \d+
>>   (?:
>>(?:,\d+)* | (?: \d+)*
>>   )
>> $/x;
>>
>> chomp (my $input = <>);
>>
>> if ($input =~ $re) {
>>   print "ok\n";
>> }
>> else {
>>   print "invalid\n";
>> }
>
> if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/)
>
> this what I did.

That is useless. If I typed

--=NONSENSE9 9NONSENSE=--

it would be accepted as valid. My code with Ruud's correction is the
simplest
way to do what you describe. Like this


  my $re = qr/^
\d+
(?:
  (?:,\d+)* | (?:[ ]\d+)*
)
  $/x;

If you expect only single-digit numbers then replace '\d+' with '\d'
throughout.
If you only expect 1 through 9 then replace them with [1-9] instead.

Rob

This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly
prohibited and may be unlawful.

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




RE: variable in perl

2008-10-14 Thread Irfan.Sayed

But then what is the difference between $0 and $^X

 

From: Jeff Pang [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 14, 2008 5:28 PM
To: Sayed, Irfan (Cognizant); beginners@perl.org
Subject: Re:variable in perl

 

> Message du 14/10/08 13:54
> De : [EMAIL PROTECTED]
> A : beginners@perl.org
> Copie à : 
> Objet : variable in perl
>
> 
> Hi All,
> 
> 
> 
> Can somebody please tell me what is the meaning of $^X .

Haven't checked "perldoc perlvar"?

   $^X The name used to execute the current copy of Perl, from C's 
"argv[0]".



Jeff.



Créez votre adresse   électronique [EMAIL PROTECTED]
1 Go d'espace de stockage, anti-spam et anti-virus intégrés.


This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message. 
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly 
prohibited and may be unlawful.


RE: Regarding reg. exp.

2008-10-14 Thread Irfan.Sayed

Because I want comma (,) exactly once

-Original Message-
From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 14, 2008 4:41 PM
To: Sayed, Irfan (Cognizant)
Cc: [EMAIL PROTECTED]; beginners@perl.org
Subject: Re: Regarding reg. exp.

[EMAIL PROTECTED] пишет:
> if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/)
>
> this what I did.
>
>   
>
Hi!

Why have you used {1} quantifier?


This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message. 
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly 
prohibited and may be unlawful.


RE: variable in perl

2008-10-14 Thread Irfan.Sayed

thanks

 

From: Jeff Pang [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 14, 2008 5:28 PM
To: Sayed, Irfan (Cognizant); beginners@perl.org
Subject: Re:variable in perl

 

> Message du 14/10/08 13:54
> De : [EMAIL PROTECTED]
> A : beginners@perl.org
> Copie à : 
> Objet : variable in perl
>
> 
> Hi All,
> 
> 
> 
> Can somebody please tell me what is the meaning of $^X .

Haven't checked "perldoc perlvar"?

   $^X The name used to execute the current copy of Perl, from C's 
"argv[0]".



Jeff.



Créez votre adresse   électronique [EMAIL PROTECTED]
1 Go d'espace de stockage, anti-spam et anti-virus intégrés.


This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message. 
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly 
prohibited and may be unlawful.


RE: Regarding reg. exp.

2008-10-14 Thread Irfan.Sayed

if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/)

this what I did.

-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]
Sent: Monday, October 13, 2008 6:49 PM
To: Perl Beginners
Cc: Sayed, Irfan (Cognizant)
Subject: Re: Regarding reg. exp.

[EMAIL PROTECTED] wrote:
>
> I have a string and I need to parse that string to check whether it is
> in required format or not. I have a Perl script which ask for user
> input. I have mentioned in the Perl script that input should be in the
> following format.
>
> For example:-  1,2,3 OR 1 2 3
>
> Which means that delimiter between these figures should be comma OR
> space. No any other character. I need all users to adhere that and if
> they not then they should exit.
>
> Can somebody please give me reg. exp. which can be used to parse the
> string and check whether comma OR space is there or not as a delimiter
> and it should contain only numeric not alphabets.

It is very draconian to require exactly one space or comma as
separators.
However this will do what you ask.

Rob


use strict;
use warnings;

my $re = qr/^
  \d+
  (?:
   (?:,\d+)* | (?: \d+)*
  )
$/x;

chomp (my $input = <>);

if ($input =~ $re) {
  print "ok\n";
}
else {
  print "invalid\n";
}

This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly
prohibited and may be unlawful.

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




sendmail module

2008-10-16 Thread Irfan.Sayed

Hi All,



I am using Perl 5.6.1 and want to sue sendmail module. I have copied the
Sendmail.pm module to the mail dir. But still it is not executing
properly.

Following is the exact error.



Can't locate MIME/Base64.pm in @INC (@INC contains:
/usr/perl5/5.6.1/lib/sun4-solaris-64int /usr/perl5/5.6.1/lib
/usr/perl5/site_perl/5.6.1/sun4-solaris-64int /usr/perl5/site_perl/5.6.1
/usr/perl5/site_perl /usr/perl5/vendor_perl/5.6.1/sun4-solaris-64int
/usr/perl5/vendor_perl/5.6.1 /usr/perl5/vendor_perl .) at
/usr/perl5/5.6.1/lib/sun4-solaris-64int/SendMail.pm line 61.

BEGIN failed--compilation aborted at
/usr/perl5/5.6.1/lib/sun4-solaris-64int/SendMail.pm line 61.

Compilation failed in require at ./cc_label.pl line 7.

BEGIN failed--compilation aborted at ./cc_label.pl line 7.



As per the FAQ, in order to install the sendmail module we have to just
copy the Perl module to the mail dir. I have done that but still the
problem is same.



Please help/suggest.



Regards

Irf.





This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly
prohibited and may be unlawful.

RE: sendmail module

2008-10-16 Thread Irfan.Sayed

Hi All/Jeff,

Somehow I am not able to install/configure Sendmail module. Can somebody
have another option/script/module then please let me know.
I am really stuck.

Please help/advise.

Regards
Irf.


-Original Message-
From: Jeff Pang [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 16, 2008 2:59 PM
To: beginners@perl.org; Sayed, Irfan (Cognizant)
Subject: Re: sendmail module



Jeff.


--- On Thu, 10/16/08, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:

> From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Subject: sendmail module
> To: beginners@perl.org
> Date: Thursday, October 16, 2008, 5:25 AM
> Hi All,
>
>
>
> I am using Perl 5.6.1 and want to sue sendmail module. I
> have copied the
> Sendmail.pm module to the mail dir. But still it is not
> executing
> properly.
>
> Following is the exact error.
>
>
>
> Can't locate MIME/Base64.pm in @INC (@INC contains:


from what you show, you need to install MIME::Base64 module, which is
used for encoding a message body.


 


This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly
prohibited and may be unlawful.

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




perl reg. exp. (search and replace)

2008-11-02 Thread Irfan.Sayed

Hi all,



I have a string which contains spaces. I need to replace those spaces
with underscore, so I have written command like this



$string="fsdfsdfsdf fsdfsdfsdf";

chomp($string1 = ($string =~ s/\s+$/_/g));

print "$string1\n";



but still $string1 is not printing proper result. Result should be
"fsdfsdfsdf_fsdfsdfsdf"



please help/suggest.



Regards

Irf





This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly
prohibited and may be unlawful.

help in redirecting output to file

2008-11-20 Thread Irfan.Sayed

Hi All,



Can somebody please help me for this block of code.



if ("$1" ne "-log"){

`$0 -log "$@" 2>&1 | tee the_log_file.$$.log`;

exit 0;

}



I know this code redirects the output of entire perl script to file but
it is not executing as expected.



Can somebody please explain / help



Regards

Irfan.





This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly
prohibited and may be unlawful.

RE: help in redirecting output to file

2008-11-23 Thread Irfan.Sayed

Thanks but I need STD output and STD error in the same file. How should I do 
that.

Regards
Irfan.


-Original Message-
From: Nitin Kalra [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 20, 2008 10:03 PM
To: Sayed, Irfan (Cognizant); beginners@perl.org
Subject: Re: help in redirecting output to file

Why don't u use this code :-

open NEW_OUT,">output.txt";

select NEW_OUT; # making output.txt to take the
default STD output

Hope this helps...
BR/Nitin

--- [EMAIL PROTECTED] wrote:

> 
> Hi All,
> 
> 
> 
> Can somebody please help me for this block of code.
> 
> 
> 
> if ("$1" ne "-log"){
> 
> `$0 -log "$@" 2>&1 | tee the_log_file.$$.log`;
> 
> exit 0;
> 
> }
> 
> 
> 
> I know this code redirects the output of entire perl
> script to file but
> it is not executing as expected.
> 
> 
> 
> Can somebody please explain / help
> 
> 
> 
> Regards
> 
> Irfan.
> 
> 
> 
> 
> 
> This e-mail and any files transmitted with it are
> for the sole use of the intended recipient(s) and
> may contain confidential and privileged information.
> If you are not the intended recipient, please
> contact the sender by reply e-mail and destroy all
> copies of the original message.
> Any unauthorised review, use, disclosure,
> dissemination, forwarding, printing or copying of
> this email or any action taken in reliance on this
> e-mail is strictly
> prohibited and may be unlawful.



  Add more friends to your messenger and enjoy! Go to 
http://messenger.yahoo.com/invite/

This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message. 
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly 
prohibited and may be unlawful.


SSH to diff. machine

2008-12-02 Thread Irfan.Sayed

Hi All,



I need to write perl script which will SSH to different machine , run
some commands and then send out the mail with the output of that
command.



Can it be possible in perl. Please let me know some sample code.



Please help/suggest.



Regards

Irf



This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly
prohibited and may be unlawful.

function is executing or not

2008-12-12 Thread Irfan.Sayed

Hi All,



I have several subroutines/functions in Perl script. I just wanted to
know how to check whether specific function/subroutine in my Perl script
is really executing or not. And if it is executing then what is the exit
status of that function.



Please help/suggest.



Regards

Irfan.





This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly
prohibited and may be unlawful.

Help in system function

2008-01-17 Thread Irfan.Sayed
Hi All,

 

I am executing following command in Perl script

 

$vw=system("mk_view $view_name ETC");

if ($vw)

 { print "view created successfully\n";

 }

 

When I run this command, I am getting message "view created
successfully". But in reality command is not executing at all

 

Please help

 

Regards

Irfan.

 



RE: Help in system function

2008-01-17 Thread Irfan.Sayed
Hi,

 

Here is the modified code

 

$vw=system("mk_view $view_name ETC");

 print "$vw\n";

 if ($vw)

 { print "view is not created\n";

 }

 else{

 print "View is created \n";

 

Please help

 

Regards

Irfan.

 

 



From: Sayed, Irfan 
Sent: Thursday, January 17, 2008 7:46 PM
To: 'beginners@perl.org'
Subject: Help in system function

 

Hi All,

 

I am executing following command in Perl script

 

$vw=system("mk_view $view_name ETC");

if ($vw)

 { print "view created successfully\n";

 }

 

When I run this command, I am getting message "view created
successfully". But in reality command is not executing at all

 

Please help

 

Regards

Irfan.

 



RE: Help in system function

2008-01-18 Thread Irfan.Sayed

Hello Rob,

I just want to find out whether command("mk_view $view_name ETC") is
properly running or not. In order to acieve this I have written this
code.

Please suggest what needs to be done to get the proper output.

Please help

Regards
Irfan.
 

-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 17, 2008 8:36 PM
To: beginners@perl.org
Subject: Re: Help in system function

[EMAIL PROTECTED] wrote:
> Hi,
> 
> Here is the modified code
> 
> $vw=system("mk_view $view_name ETC");
> 
> print "$vw\n";
> 
> if ($vw)
> 
> { print "view is not created\n";
> 
> }
> 
> else{
> 
>  print "View is created \n";
>  
> 
> Please help

And what is the modified problem?

Rob

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



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




Hiding standard output

2008-02-01 Thread Irfan.Sayed
Hi All,
 
I want to hide the standard output on the terminal when I am executing
the Perl script. For example I am running this command
"`/usr/atria/bin/cleartool lslock lbtype:$dep_lbl`;
 
if the execution of this command failed then whatever output is coming
on the terminal I want to hide that and I want to print my standard
statement.
 
Can I do that
 
Please help
 
Regards
Irfan.
 
 
Project Lead
TSINDIA - Production Line
Individual Software Solutions - UMO
T-Systems India Private Limited, Pune
Telephone: +91-20-30245000/25605000 (Extn: 5406) 
Mobile: +91 9822 854 227
Fax: ++91-020 25674090
Internet: http://www.t-systems.com
http://www.t-systems.com/> 
 


RE: regarding regular expression

2008-02-11 Thread Irfan.Sayed

Thanks John. OOps I did not mentioned one condition while writing the
regular expression.

condition is : If after last dot(.) there are three digit then don't do
anything but if after last dot(.) there are no exactly three digit then
replace that dot(.) and all digits after that dot with space.

Please help.

Regards
Irfan.

 


Project Lead
TSINDIA - Production Line
Individual Software Solutions - UMO
T-Systems India Private Limited, Pune
Telephone: +91-20-30245000/25605000 (Extn: 5406) 
Mobile: +91 9822 854 227
Fax: ++91-020 25674090
Internet: http://www.t-systems.com

-Original Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 11, 2008 6:35 PM
To: Perl Beginners
Subject: Re: regarding regular expression

[EMAIL PROTECTED] wrote:
> Hi All,

Hello,

> I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is 
> that I want to remove last dot (.) and all the characters/digit after 
> that dot with the help of regular expression.

$ perl -le'
$_ = "D.PRS.WEB.02.10.001.1";
print;
s/\.[^.]*\z//;
print;
'
D.PRS.WEB.02.10.001.1
D.PRS.WEB.02.10.001



John
--
Perl isn't a toolbox, but a small machine shop where you can
special-order certain sorts of tools at low cost and
in short order.-- Larry Wall

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



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




regarding regular expression

2008-02-11 Thread Irfan.Sayed
Hi All,
 
I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is
that I want to remove last dot (.) and all the characters/digit after
that dot with the help of regular expression.
 
Please help.
 
Regards
Irfan.
 
Project Lead
TSINDIA - Production Line
Individual Software Solutions - UMO
T-Systems India Private Limited, Pune
Telephone: +91-20-30245000/25605000 (Extn: 5406) 
Mobile: +91 9822 854 227
Fax: ++91-020 25674090
Internet: http://www.t-systems.com
http://www.t-systems.com/> 
 


array question

2008-02-26 Thread Irfan.Sayed
Hello All,

 

I have two arrays contains exact no.  of elements. Now what I need to do
is , I want to execute certain commands to each elements of the array at
a time.

 

It means that I want take first element of first array and first element
of second array and then want to execute certain commands considering
these two elements.

I don't know how should I achieve this in perl.

 

Please help.

 

Regards

Irfan.

 

 



variable help

2008-03-04 Thread Irfan.Sayed
Hi All,

 

How to find out the specific variable contains integer value. In my
script ,variable is storing some value but I want to find out whether
that value is string or integer.

 

Please help

 

Regards

Irfan.



RE: variable help

2008-03-04 Thread Irfan.Sayed
Thanks Brown. It worked.


-Original Message-
From: Rodrick Brown [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 05, 2008 1:50 AM
To: Sayed, Irfan
Cc: beginners@perl.org
Subject: Re: variable help

#!/usr/bin/perl

my $p = 10;

if( int($p) ) {
  print "$p is an interger\n";
}
~


On Tue, Mar 4, 2008 at 3:16 PM,  <[EMAIL PROTECTED]> wrote:
> Hi All,
>
>
>
> How to find out the specific variable contains integer value. In my
> script ,variable is storing some value but I want to find out whether
> that value is string or integer.
>
>
>
> Please help
>
>
>
> Regards
>
> Irfan.
>
>



-- 
Rodrick R. Brown
http://www.rodrickbrown.com
http://www.linkedin.com/in/rodrickbrown

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




RE: variable help

2008-03-04 Thread Irfan.Sayed
Thanks.

Can you please explain the reg. expression in more detail.

Please

--Irfan.


Project Lead
TSINDIA - Production Line
Individual Software Solutions - UMO
T-Systems India Private Limited, Pune
Telephone: +91-20-30245000/25605000 (Extn: 5271) 
Mobile: +91 9822 854 227
Fax: ++91-020 25674090
Internet: http://www.t-systems.com


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of yitzle
Sent: Wednesday, March 05, 2008 2:12 AM
To: Rodrick Brown
Cc: Sayed, Irfan; beginners@perl.org
Subject: Re: variable help

This approach does not consider "0" to be an integer.
I'd use a RegEx and test to see if the string is made up entirely of integers.
  print "The variable containing $p is an interger\n" if ($p =~ /^[0-9]+$/);

On Tue, Mar 4, 2008 at 3:19 PM, Rodrick Brown <[EMAIL PROTECTED]> wrote:
> #!/usr/bin/perl
>
>  my $p = 10;
>
>  if( int($p) ) {
>   print "$p is an interger\n";
>  }
>  ~
>
>
>
>
>  On Tue, Mar 4, 2008 at 3:16 PM,  <[EMAIL PROTECTED]> wrote:
>  > Hi All,
>  >
>  >
>  >
>  > How to find out the specific variable contains integer value. In my
>  > script ,variable is storing some value but I want to find out whether
>  > that value is string or integer.
>  >
>  >
>  >
>  > Please help
>  >
>  >
>  >
>  > Regards
>  >
>  > Irfan.
>  >
>  >
>
>
>
>  --
>  Rodrick R. Brown
>  http://www.rodrickbrown.com
>  http://www.linkedin.com/in/rodrickbrown
>
>  --
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>  http://learn.perl.org/
>
>
>

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