in reply to Re: Print Color Format
in thread Print Color Format

Thanks toolic!
your code works as is, however when I insert a split code, which removes ":" from each field from the data file, I received an "uninitialized value for $_" error? I am confused as to why that is? Thoughts? Thanks!

Replies are listed 'Best First'.
Re^3: Print Color Format
by toolic (Bishop) on Jun 16, 2015 at 18:10 UTC

      Good webpage..never seen it before thanks. I should of posted more code including the "split" section.

      foreach my $Name2 (@lines) { my @field = split(':',$Name2); if ($field[1] =~ /(?<![\w-])$Name(?![\w-])/i) { my $format = " %-4s %-11s %-13s %-10s %-7s %0s\n"; print color 'bold green'; printf ($format, $field[0], $field[1], $field[2], $field[3], $field[4] +, $field[5]); } }

      Complete Code

        This is incomplete because I don't know what the @lines array contains (or $Name). I suspect some of your lines have fewer than 6 fields. See also the basic debugging checklist