Home > Archive > PERL Beginners > September 2006 > Proper output
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Irfan Sayed 2006-09-22, 3:57 am |
| Hi All,
I am not getting the proper output in @vob_rep Array.
Following is my code
# Perl script to change the replica name
use strict;
use warnings;
my $fname = "/tmp/vob_list1";
open FILE,">",$fname or die $!;
my $fname1 = "/tmp/repl_list1";
open FILE1,">",$fname1 or die $!;
my $CT = '/usr/atria/bin/cleartool';
my $MT = '/usr/atria/bin/multitool';
my @vob_list = `$CT lsvob -s`;
print FILE @vob_list;
my @repl;
my @repl1;
foreach my $a (@vob_list)
{
@repl = `$CT lsreplica -s -invob $a`;
@repl1 = grep { /cmvobsvr1mum/i } @repl; print FILE1 @repl1; } my
@vob_rep = splice(@repl1, 0, -10); print @vob_rep;
close FILE1;
Plz help
Regards
Irfan.
| |
| initself 2006-09-22, 3:57 am |
|
Irfan Sayed wrote:
> Hi All,
>
Bro, chill out on the spaces.
1) What output to your expect?
2) What output are you getting?
mb
| |
| John W. Krahn 2006-09-22, 3:57 am |
| Sayed, Irfan (Irfan) wrote:
> Hi All,
Hello,
> I am not getting the proper output in @vob_rep Array.
What is it doing that you don't want it to do? What is it not doing?
John
--
use Perl;
program
fulfillment
| |
| Paul Lalli 2006-09-22, 7:57 am |
| Irfan Sayed wrote:
> I am not getting the proper output in @vob_rep Array.
You're getting exactly the output you asked for. If that's not the
output you *want*, how are we supposed to determine how it differs from
what you want?
> Following is my code
>
> # Perl script to change the replica name
>
> use strict;
>
> use warnings;
What the heck's with all the double spaces? Please don't do that.
>
> my $fname = "/tmp/vob_list1";
> open FILE,">",$fname or die $!;
Please use lexical filehandles. I'm pretty sure this is not the first
time you've been asked that.
> my $fname1 = "/tmp/repl_list1";
> open FILE1,">",$fname1 or die $!;
> my $CT = '/usr/atria/bin/cleartool';
> my $MT = '/usr/atria/bin/multitool';
> my @vob_list = `$CT lsvob -s`;
> print FILE @vob_list;
> my @repl;
> my @repl1;
> foreach my $a (@vob_list)
> {
> @repl = `$CT lsreplica -s -invob $a`;
Did you forget how to indent the same time you developed the
double-spacing affliction?
> @repl1 = grep { /cmvobsvr1mum/i } @repl;
> print FILE1 @repl1;
You are aware you're changing @repl1 each time through this loop,
right? Overwriting the previous contents?
> }
> my @vob_rep = splice(@repl1, 0, -10);
So that here, @repl1 contains only the values that were in @repl1 in
the *last* iteration of the loop? Is that what you intended?
> print @vob_rep;
>
> close FILE1;
>
> Plz help
I *know* this isn't the first time I've asked you this - STOP TALKING
LIKE A CHILD! Spell out your words. This is not difficult! "Please"
is not dramatically more difficult to type than "Plz", and it won't
make you look and sound like an idiot to those from whom you're asking
for help.
Paul Lalli
| |
| Irfan Sayed 2006-09-25, 7:58 am |
|
Can any body please help on this
Regards
Irfan.
_____
From: Sayed, Irfan (Irfan)
Sent: Friday, September 22, 2006 12:59 PM
To: beginners@perl.org
Subject: Proper output
Hi All,
I am not getting the proper output in @vob_rep Array.
Following is my code
# Perl script to change the replica name
use strict;
use warnings;
my $fname = "/tmp/vob_list1";
open FILE,">",$fname or die $!;
my $fname1 = "/tmp/repl_list1";
open FILE1,">",$fname1 or die $!;
my $CT = '/usr/atria/bin/cleartool';
my $MT = '/usr/atria/bin/multitool';
my @vob_list = `$CT lsvob -s`;
print FILE @vob_list;
my @repl;
my @repl1;
foreach my $a (@vob_list)
{
@repl = `$CT lsreplica -s -invob $a`;
@repl1 = grep { /cmvobsvr1mum/i } @repl; print FILE1 @repl1; } my
@vob_rep = splice(@repl1, 0, -10); print @vob_rep;
close FILE1;
Plz help
Regards
Irfan.
| |
| Paul Lalli 2006-09-25, 7:58 am |
| Irfan Sayed wrote:
> Can any body please help on this
THREE different people have now responded, TRYING to help you, and
telling you that there is no way to help you without more information.
Specifically, what output ARE you getting, and what output do you WANT
to be getting?
Why do you think you don't have to put any effort into these posts?
Why do you think people can read your mind?
Paul Lalli
| |
| D. Bolliger 2006-09-25, 6:57 pm |
| Sayed, Irfan (Irfan) am Montag, 25. September 2006 14:50:
> Can any body please help on this
>
> Regards
> Irfan.
Hello
please read on at the bottom.
_____
>
> From: Sayed, Irfan (Irfan)
> Sent: Friday, September 22, 2006 12:59 PM
> To: beginners@perl.org
> Subject: Proper output
>
>
>
> Hi All,
> I am not getting the proper output in @vob_rep Array.
>
> Following is my code
>
> # Perl script to change the replica name
>
> use strict;
>
> use warnings;
>
> my $fname = "/tmp/vob_list1";
>
> open FILE,">",$fname or die $!;
>
> my $fname1 = "/tmp/repl_list1";
>
> open FILE1,">",$fname1 or die $!;
>
> my $CT = '/usr/atria/bin/cleartool';
>
> my $MT = '/usr/atria/bin/multitool';
>
> my @vob_list = `$CT lsvob -s`;
>
> print FILE @vob_list;
>
> my @repl;
>
> my @repl1;
>
> foreach my $a (@vob_list)
>
> {
>
> @repl = `$CT lsreplica -s -invob $a`;
>
> @repl1 = grep { /cmvobsvr1mum/i } @repl; print FILE1 @repl1; } my
> @vob_rep = splice(@repl1, 0, -10); print @vob_rep;
>
> close FILE1;
>
> Plz help
>
> Regards
>
> Irfan.
Please don't top post. The answer follows the question, that's the natural
order.
Did you read John W. Krahn's hints?
Please, if you expect help from people that can't read minds:
Describe your problem. What means "proper output"? What should be the output?
What improper output did you get?
Your script uses external programs that not everybody has installed (I think)
or even has heard of (at least me). This makes it difficult/impossible to
test your script.
It's not clear if that what goes wrong is on the external programs or the perl
level.
Please try to narrow down the place(s) where the "misfunction" may occur. Did
you insert some simple "debug" statements as for example warn calls to see if
the output is as you expect? Can you identify lines where something goes
wrong?
If you try to answer such questions, you may find the misfunction yourself. If
not, it makes you able to shorten the scripts to the relevant parts.
patient: "I'm feeling ill. What should I do?"
doctor : "Where do you feel ill?"
patient: (silence)
doctor : (waiting)
patient: "Please, can you help? I'm feeling ill!"
doctor : "Next patient please!"
Dani
| |
| Rob Dixon 2006-09-25, 6:57 pm |
| Sayed, Irfan (Irfan) wrote:
>
> I am not getting the proper output in @vob_rep Array.
>
> Following is my code
>
> # Perl script to change the replica name
>
> use strict;
>
> use warnings;
>
> my $fname = "/tmp/vob_list1";
>
> open FILE,">",$fname or die $!;
>
> my $fname1 = "/tmp/repl_list1";
>
> open FILE1,">",$fname1 or die $!;
>
> my $CT = '/usr/atria/bin/cleartool';
>
> my $MT = '/usr/atria/bin/multitool';
>
> my @vob_list = `$CT lsvob -s`;
>
> print FILE @vob_list;
>
> my @repl;
>
> my @repl1;
>
> foreach my $a (@vob_list)
>
> {
>
> @repl = `$CT lsreplica -s -invob $a`;
>
> @repl1 = grep { /cmvobsvr1mum/i } @repl; print FILE1 @repl1; } my
> @vob_rep = splice(@repl1, 0, -10); print @vob_rep;
>
> close FILE1;
John W. Krahn wrote:
>
> What is it doing that you don't want it to do? What is it not doing?
Sayed, Irfan (Irfan) wrote:
>
> Can any body please help on this
I can tell you what's probably wrong with your program Irfan, but I'm as
frustrated as Dani is that you didn't respond to John's question. You may as
well have written 'fix this please'.
The line
my @vob_list = `$CT lsvob -s`;
puts the output from lsvob into @vob_list which, because of the -short qualifier
is just a list of VOB tags, but each one is terminated with a newline. When you
go to use the tags in the lsreplica command the trailing newline is almost
certainly messing up the -invob qualifier, so I suspect your result is that no
replicas are found?
To fix it, just
my @vob_list = `$CT lsvob -s`;
chomp @vob_list;
I hope that works for you, but please try to explain your problem properly in
future and also try to appear to have worked on it a little yourself. And, like
Dani said, please bottom-post.
For others' benefit, cleartool is a version control system, A VOB is a Version
Object Base.
Cheers,
Rob
| |
| DJ Stunks 2006-09-25, 6:57 pm |
| Rob Dixon wrote:
> The line
>
> my @vob_list = `$CT lsvob -s`;
>
> puts the output from lsvob into @vob_list which, because of the -short qualifier
> is just a list of VOB tags, but each one is terminated with a newline. When you
> go to use the tags in the lsreplica command the trailing newline is almost
> certainly messing up the -invob qualifier, so I suspect your result is that no
> replicas are found?
> <snip>
> For others' benefit, cleartool is a version control system, A VOB is a Version
> Object Base.
Rob, allow me to suggest that you immediately submit your resume to
Avaya. You could, apparently, reduce their cycle times by upwards of 6
months.
Let me know if you need a reference,
-jp
| |
| Irfan Sayed 2006-09-26, 7:57 am |
|
Hi,
I apologize for my mistake. In future I will take care of sending all
the messages in proper fashion and in descriptive manner.
Regards
Irfan.
-----Original Message-----
From: Rob Dixon [mailto:rob.dixon@350.com]=20
Sent: Tuesday, September 26, 2006 3:14 AM
To: beginners@perl.org
Subject: Re: Proper output
Sayed, Irfan (Irfan) wrote:
>
> I am not getting the proper output in @vob_rep Array.
>
> Following is my code
>
> # Perl script to change the replica name > > use strict; > > use
warnings; > > my $fname =3D "/tmp/vob_list1"; > > open =
FILE,">",$fname
or die $!; > > my $fname1 =3D "/tmp/repl_list1"; > > open
FILE1,">",$fname1 or die $!; > > my $CT =3D =
'/usr/atria/bin/cleartool';
lsvob -s`; > > print FILE @vob_list; > > my @repl; > > my @repl1;[color=darkred]
> @repl =3D `$CT lsreplica -s -invob $a`;
>
> @repl1 =3D grep { /cmvobsvr1mum/i } @repl; print FILE1 @repl1; } my
> @vob_rep =3D splice(@repl1, 0, -10); print @vob_rep;
>
> close FILE1;
John W. Krahn wrote:
>
> What is it doing that you don't want it to do? What is it not doing?
Sayed, Irfan (Irfan) wrote:
>
> Can any body please help on this
I can tell you what's probably wrong with your program Irfan, but I'm as
frustrated as Dani is that you didn't respond to John's question. You
may as well have written 'fix this please'.
The line
my @vob_list =3D `$CT lsvob -s`;
puts the output from lsvob into @vob_list which, because of the -short
qualifier is just a list of VOB tags, but each one is terminated with a
newline. When you go to use the tags in the lsreplica command the
trailing newline is almost certainly messing up the -invob qualifier, so
I suspect your result is that no replicas are found?
To fix it, just
my @vob_list =3D `$CT lsvob -s`;
chomp @vob_list;
I hope that works for you, but please try to explain your problem
properly in future and also try to appear to have worked on it a little
yourself. And, like Dani said, please bottom-post.
For others' benefit, cleartool is a version control system, A VOB is a
Version Object Base.
Cheers,
Rob
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org For additional
commands, e-mail: beginners-help@perl.org <http://learn.perl.org/>
<http://learn.perl.org/first-response>
| |
| DJ Stunks 2006-09-26, 7:57 am |
|
Irfan Sayed wrote:
> Hi,
>
> I apologize for my mistake. In future I will take care of sending all
> the messages in proper fashion and in descriptive manner.
>
> <snip TOFU>
In this fantasy future world you speak of, could you also stop top
posting? It'll make it easier for me to read posts from you about your
life's work (yes, the 10-line VOB script) in my flying car.
-jp
|
|
|
|
|