Sponsored Content
Top Forums Shell Programming and Scripting Perl - Problems iwith colors while printing from dynamic array at runtime.. Post 302345170 by som.nitk on Tuesday 18th of August 2009 03:18:17 PM
Old 08-18-2009
Perl - Problems iwith colors while printing from dynamic array at runtime..

Hi Perl folks,
I am having problems printing elements from an array at runtime.
I wish to push elements into array at runtime and the print it later.
Now I wish to print this matrix using colors.

So I do something like this to enter the runtime values in array:
Code:
                        for(my $i = 0; $i < $#block_array_750; $i++)
                        {
                                if ($compare_var eq $block_array_750[$i])
                                {
                                        #print "Val: $block_array_750[$i],Hash: $running_hotfix_hash{$key} Plat: $platform\n";
if ($running_hotfix_hash{$key} eq "FIN") { $status = BOLD WHITE "FIN", RESET; }
if ($running_hotfix_hash{$key} eq "RUN") { $status = BOLD RED "RUN", RESET; }
if ($running_hotfix_hash{$key} eq "INP") { $status = BOLD GREEN "INP", RESET; }
if ($running_hotfix_hash{$key} eq "HLD") { $status = BOLD WHITE "HLD", RESET; }
if ($running_hotfix_hash{$key} eq "CAN") { $status = BOLD WHITE "CAN", RESET; }
if ($running_hotfix_hash{$key} eq "PND") { $status = BOLD YELLOW "PND", RESET; }
                                        if ($platform eq "HP")  {$block_array_750[$i+1] = $status;}
                                        if ($platform eq "HPX") {$block_array_750[$i+2] = $status;}
                                        if ($platform eq "SUN") {$block_array_750[$i+3] = $status;}
                                        if ($platform eq "AIX") {$block_array_750[$i+4] = $status;}
                                }
                        }

Now sometime later in code, I am printing this array:

Code:
sub DisplayMatrix
{
        print "\n";
        for (my $i =0; $i < $#array_750; $i++)
        {
                print "\t\t\t$array_750[$i]\t\t$array_750[$i+1]\t\t$array_750[$i+2]\t\t$array_750[$i+3]\t\t$array_750[$i+4]\n";
                $i += 4;
}


But while printing the matrix, the colored rows are not indented properly. They tend to shift to left or right making the whole indentation unproper.
Just to add more, I observed if I dont use colors the matrix printing is proper. Also those rows are dislocated which have colors in them.
Is this a problem with colors?

How can I use colors and keep the matrix indentation proper?
Please advise.

Thanks.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Printing Problems in unix ... ( Bar-cdoe - Ip Printing)

Hi guys ... i need ur help with some printing problem in unix ... first prob. : i wanna print from my NCR unix to an Win NT , Ip based printing server ( HP JetDirect ) . My issue , is it possible to print directly to an Ip address from unix ? How do i make it work to get any results ?... (3 Replies)
Discussion started by: QuickSilver
3 Replies

2. Shell Programming and Scripting

creating a dynamic array in ksh

Hi, Is it possible to create a dynamic array in shell script. I am trying to get the list of logfiles that created that day and put it in a dynamic array. I am not sure about it. help me New to scripting Gundu (3 Replies)
Discussion started by: gundu
3 Replies

3. Shell Programming and Scripting

Dynamic Array Issue

Could one of you, please, provide some input regarding my problem below and it is as follows: I have 2 files that I need to make sure are identical before processing: First, I sort both files Second, I do a diff file1 file2 > File 3 This provides me with the difference. Now, I need to... (6 Replies)
Discussion started by: ddedic
6 Replies

4. Shell Programming and Scripting

creating a dynamic array

i want to create an array the array elements are populated depending upon the number of entries present in a data file The data file is created dynamically how to achieve the same thanks (1 Reply)
Discussion started by: trichyselva
1 Replies

5. UNIX for Advanced & Expert Users

perl colors in nedit editor

Hi, I would like to change the color of the nedit editor for perl scripts. I tried to find the .nedit file in my $HOME directory but didn't find it. Can anyone tell where can I find the .nedit file or where can I modify the color for perl scripts in the nedit editor ? Thanks in... (2 Replies)
Discussion started by: Alalush
2 Replies

6. Programming

Creating an array to hold posix thread ids: Only dynamic array works

I am facing a strange error while creating posix threads: Given below are two snippets of code, the first one works whereas the second one gives a garbage value in the output. Snippet 1 This works: -------------- int *threadids; threadids = (int *) malloc (num_threads * sizeof(int)); ... (4 Replies)
Discussion started by: kmehta
4 Replies

7. Programming

array dynamic allocation

Hi, I have the following problem: i must allocate a dynamic array from a subroutine which should return such array to main function. The subroutine has already a return parameter so i thought of pass the array as I/O parameter. I tried the following program but it doesn't work (segmentation... (11 Replies)
Discussion started by: littleboyblu
11 Replies

8. Solaris

Runtime Linker Problems ld.so.1

Hello all, I am releatively new to Solaris and I am the System administrator for my branch at the FAA. This is the first time I can say I have really messed something up thankfully. My issue came up after installing and uninstalling Oracle Secure Backup which i felt I needed to do a clean... (7 Replies)
Discussion started by: jbirkes
7 Replies

9. Shell Programming and Scripting

ksh Array name determined at runtime

I'm working on a ksh script and was wondering if anyone knows if it's possible to access an array by a variable that is determined at runtime? I have created a test example below, but essentially I will have declared and populated an array (see colorArray below). What I'd like to do is access... (9 Replies)
Discussion started by: bs103950
9 Replies

10. UNIX for Beginners Questions & Answers

Bash array variables are changed in loop runtime

I am trying to check whether particular host and port are responding or not. I am using below script to check. but node_port array that i am using in loop is getting replaced with previous iteration value. Script and output is given. Please help me to understanding why node_port values are... (5 Replies)
Discussion started by: tmalik79
5 Replies
mlib_VideoColorSplit3_S16(3MLIB)			    mediaLib Library Functions				  mlib_VideoColorSplit3_S16(3MLIB)

NAME
mlib_VideoColorSplit3_S16 - color conversion (color channel split) SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_VideoColorSplit3_S16(mlib_s16 *color1, mlib_s16 *color2, mlib_s16 *color3, const mlib_s16 *colors, mlib_s32 n); DESCRIPTION
The mlib_VideoColorSplit3_S16() function performs color channel split. The elements of the colors array are selected in consecutive groups of three. As each group is processed, the first element is stored in the color1 array; the second element, in the color2 array; and the third element, in the color3 array. This process is repeated untill the end of the colors array is reached. PARAMETERS
The function takes the following arguments: color1 Pointer to first color component row. color1 must be 8-byte aligned. color2 Pointer to second color component row. color2 must be 8-byte aligned. colors Pointer to colors multi-component row. colors must be 8-byte aligned. n Length of color1, color2, and color3 arrays. Length of colors must be 3*n. RETURN VALUES
The function returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
mlib_VideoColorMerge2(3MLIB), mlib_VideoColorMerge2_S16(3MLIB), mlib_VideoColorMerge3(3MLIB), mlib_VideoColorMerge3_S16(3MLIB), mlib_Video- ColorMerge4(3MLIB), mlib_VideoColorMerge4_S16(3MLIB), mlib_VideoColorSplit2(3MLIB), mlib_VideoColorSplit2_S16(3MLIB), mlib_VideoColor- Split3(3MLIB), mlib_VideoColorSplit4(3MLIB), mlib_VideoColorSplit4_S16(3MLIB), attributes(5) SunOS 5.10 9 Nov 2004 mlib_VideoColorSplit3_S16(3MLIB)
All times are GMT -4. The time now is 02:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy