Parse through a txt file PERL scripting

Below is a perl code I am trying.

#!/usr/bin/perl

#use strict;
use warnings qw/ all FATAL /;

use constant ENV_FILE => '/apps/env_data.txt';

$uenv = $ARGV[0];

my $input = $uenv;


open my $fh, '<', ENV_FILE
    or die sprintf qq{Unable to open "%s" for input: $!}, ENV_FILE;

LINE:
while ( <$fh> ) {
    next unless /\S/;
    my ($env, $dir, $servers) = split;
    next unless $env eq $input;

    for my $server ( split /,/, $servers ) {

        ## Connect to $server and access $dir
        system "ssh $server 'cat $dir/server.properties'";

        last LINE;
    }
}

cat /apps/env_data.txt

qa1 /apps/8801/conf qavm01,qavm02,qavm03
qa2 /apps/8901/conf qavm01,qavm03,qavm04
qa3 /apps/8701/conf qavm01,qavm04,qavm02
cpc /apps/19100/conf cpcint101
cpc2 /apps/19101/conf cpcint02

for some reason the script is connecting to only $server out of the $servers to display the value. Any thoughts on it? I am still learning perl. So I might be making silly mistakes.

remove line

last LINE;

and try .

A bit simpler?

#!/usr/bin/env perl
#
use strict;
use warnings;

my $env_file = '/apps/env_data.txt';
my $uenv = shift or die "Missing uenv parameter";

open my $fh, '<', $env_file or die "Unable to open $env_file: $!";

while(<$fh>) {
    if(/^$uenv\s/) {
        my ($env, $dir, $servers) = split;
        for my $server (split /,/, $servers) {
            system "ssh $server 'cat $dir/server.properties'";
        }
        last;
    }
}