-----Original Message-----
From: Sayed, Irfan (Irfan) [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 09, 2007 9:52 AM
To: [email protected]
Subject: Dynamically assign the no.

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.
 

[>>] 
Not sure if this helps but here's a "solution..."

SUN1-BATCH>./foo
1. APC
2. PDS
3. OA
4. IC
SUN1-BATCH>more foo
#! /usr/local/bin/perl
my %store;
while (<DATA>){
        print "$.. $_";
        $store{$.} = $_;
        }
__DATA__
APC
PDS
OA
IC

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


Reply via email to