I'm currently building a script to find a code in a document that has "x" amount of text, so far I can get the matches or matches but I can not bring only the code because it brings me the whole line where the code is found, I just want to discard all the text and bring me only the code "500 5.1.1" If it is inside the document. Any help would be very grateful!
use strict;
use warnings;
my $resultado;
open (BUSCAR, "<", "/home/lserrano/Documentos/perl/files/devueltos2018ls.txt");
while (<BUSCAR>){
if(m/([5])(0)/){
$resultado = $_;
print $resultado;
};
}