title: split array element in perl
body: <p>I have an array in Perl where each element contains the a username and password which is seperated by a space. I.e.</p>
  
  <pre><code>@listOfUser = {testuser password1, testuser2 password2, testuser3 password3};
  </code></pre>
  
  <p>I want to loop through the array and split each element into two strings. For example, I want to take the first element in the array and assign it to a variable called username and the respective password to a variable called passwd. </p>
  
  <p>Essentially my question is that I want to split an array element into two strings!</p>
  
  <hr>
  
  <p>I am using perl. Let's speak generally. I have an array which contains several elements.</p>
  
  <p>Each element is in the format: <code>sometext mypassword</code>
  Basically each element contains a username followed by a space and then a password.</p>
  
  <p>I want to be able to grab each element and split the element so that </p>
  
  <pre><code>my $username = sometext
  my $password = password
  </code></pre>
  
  <p>I will then pass the two strings into a function using a foreach loop</p>