Powershell looping foreach

I’m traditional bash user therefore i don’t understand how to work foreach in powershell.

Powershell

I need output

Vasya  Misha  

but I receive another output

Vasya Misha   

Script

$  pspath="E:\monitor.ps1" $  txtpath="E:\temp.txt" $  user1="Vasya" $  user2="Misha" $  ip1="http://192.168.10.61:8085/data.json" $  ip2="http://192.168.10.82:8085/data.json"   $  list = @" $  {user1}-$  {ip1} $  {user2}-$  {ip2} "@  foreach ($  zab in $  list) {     $  regex_url = 'http://\d+.\d+.\d+.\d+:\d+/data.json'     $  regex_name = "([A-Z]|[a-z])\w+"     $  name =  echo $  zab |%{$  _.split('-')} |sls -pattern $  regex_name -AllMatches |%{$  _.Matches -notmatch 'http|json|data'} |%{$  _.Value}     $  url = echo $  zab |%{$  _.split('-')} |sls -pattern $  regex_url -AllMatches |%{$  _.Matches} |%{$  _.Value}     echo $  name     echo $  url } 

Bash

In bash work’s perfect.

Script

 #!/bin/bash users="Vasya-http://192.168.10.61:8085/data.json Misha-http://192.168.10.82:8085/data.json"   for zab in $  users; do     name=$  (echo $  zab |cut -f 1 -d -)     url=$  (echo $  zab |cut -f 2 -d -)     echo $  name     echo $  url  done exit 0  

Help guys my hands are tied.