my @ente = map { "\/dev\/sd$_" } ('x', 'y', 'z'); foreach my $h (@ente) { my $output = "smartctl \-l ssd $h| grep Percent | cut \-c 29,30 "; }