while () { my (@values1) = ('Not set', 'Really not set'); my (@val1) = ('Nothing here', 'Nor here'); # Nothing changed below here if ( $_ =~ /PING/ ){ @values1 = split ; @val1 = split(/\(/,$values1[3]); $val1[1] =~ s/\)//; } print "$values1[1] \n"; print "$val1[0] \n"; }