Un saludo, Tengo este código con el que busco hasta el final de la linea pero me gustaría que busque hasta que se consigue un punto para que me extraiga un texto con coherencia. A continuación el código: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> #!/usr/bin/perl use strict; use warnings; my $body; my $smtpCode; $body = "Diagnostic-Code: smtp; 550-5.1.1 The email account that you tried to reach does not exist. Please try 550-5.1.1 double-checking the recipient's email address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1 https://support.google.com/mail/?p=NoSuchUser s35si4587705qvc.145 - gsmtp"; foreach ( split( /\n/, $body ) ) { next if (/^\s*$/); if ( $_ =~ /^Diagnostic-Code:\ssmtp;\s(.*)$/) { $smtpCode = $1; print $smtpCode; #Salida: 550-5.1.1 The email account that you tried to reach does } } <!-- end snippet --> Y lo que realmente me gustaría que mostrara es lo siguiente: 550-5.1.1 The email account that you tried to reach does not exist. O que por lo menos muestre todo el parrafo despues de `Diagnostic-Code: smtp;` 550-5.1.1 The email account that you tried to reach does not exist. Please try 550-5.1.1 double-checking the recipient's email address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1 https://support.google.com/mail/?p=NoSuchUser s35si4587705qvc.145 - gsmtp