#!/usr/bin/perl use strict; use warnings; my ($l,$p); while(<>) { chomp; my ($k,$v) = split(/\=/); $l = $v if lc($k) eq 'key'; if(lc($k) eq 'value') { $p = $v; print "$l:$p\n"; } }