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

@lines is data retrieved from the data file and Name is the query used to pull from the data file...complete code below:

open(MYINPUTFILE, "namedata.txt"); my @lines = <MYINPUTFILE>; close (MYINPUTFILE); my $Name = <STDIN>; $Name = <STDIN> until defined $Name; chomp($Name); 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]); } } __DATA__ ID:Name:Last:Birthday:Phone:Email:Website