On Aug 9, 9:52 am, [EMAIL PROTECTED] (Irfan Sayed) wrote:
> Hi All,
>
> I am running one system command in my perl script. The output of this
> command is different every time. sometimes it gives 3 line output
> sometimes 4 line output.
>
> Now my req. is that I need to catch this output and assign serial no.s
> to them.
>
> for example : command is " cleartool lsproj"
> output is as follows.
> APC
> PDS
> OA
> IC
>
> Now when i run the perl script output should look like
>
> 1. APC
> 2. PDS
> 3. OA
> 4. IC
>
> Your choice :
>
> and this number assigning should happen dynamically,it should not be
> hard coded so that I can select the project whichever I want and start
> working.
>
> can somebody please help.
This is pretty trivial. It would be a lot more helpful if you would
start posting your best attempt at solving your problems, so that
people can understand how/where you're having difficulties, and help
you to learn.
my $i = 1;
for my $line (`cleartool lsproj`) {
print "$i. $line";
}
print "Your choice: \n";
chomp(my $choice = <STDIN>);
__END__
Paul Lalli
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/