You are getting only one IP address, because it is exactly what you are doing by applying the regex ONCE on the whole $login.
#we split $login into an array, line-by-line
my @lines = split("\n",$login);
for my $line (@lines) {
#now we iterate through every line one-by-one
$line =~ /(?<ip>\d+\.\d+\.\d+\.\d+)/;
print $+{"ip"}."\n";
}
Here we iterated through every line on $login and we applied the regex for each line individually..Instead of printing ofc you can do whatever you want with that ip.
Also I'm using here named match, which is only my preference, you don't have to use it.