in reply to Splitting a string... Duh?

Presumably, you'll want to do this for every line in the file. I'm also going to guess that the list of servers will need to be read into an array. This oughta do it.

@file = ( "SERVER1/OU=00/OU=LOCATION/O=COMPANY", "SERVER2/OU=00/OU=LOCATION/O=COMPANY", "SERVERXYZ6/OU=00/OU=LOCATION/O=COMPANY", "SERVERFOOBAR/OU=01/OU=LOCATION/O=COMPANY" ); <p> foreach $string(@file) { @sections = split ("/", $string); $name = $sections[0]; push @servers, $name; } foreach $machine(@servers) { print STDOUT "Machine = $machine\n"; }

Originally posted as a Categorized Answer.