On Aug 9, 9:52 am, [EMAIL PROTECTED] (Irfan Sayed) wrote: > 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.
(followup to my first post in this thread, which Google Groups isn't showing yet) Or, if you need to save the output and display it, so that you can later refer to it after the user picks which number he wants: my @lines = `cleartool lsproj`; my $i = 1; foreach my $line (@lines) { print "$i. $line"; $i++; } print "Your choice: \n"; chomp (my $choice = <STDIN>); my $user_choice = $lines[$choice-1]; Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/