open (NAVI ,"$Ausgabe "); while (my $line = ) { if ($line =~ m/SPPORT/ ) { $port_section = 1; } if($port_section == 1) { next if($line =~ m/^SP\sName:\s+SP+\s+($SP)/); next if($line =~ m/^SP\sPort\sID:\s+($PORT)/); if($line =~ m/^Link\sStatus:\s+(\w+)/){ $status_link = $1; print"$status_link\n"; } } close (NAVICLIOUT);