title: Scope of variables in KSH
body: <p>I have written a sample KornShell function to split a String, put it in an array and then print out the values.
  The code is as below</p>
  
  <pre><code>#!/usr/bin/ksh
  
  splitString() {
  
      string="abc@hotmail.com;xyz@gmail.com;uvw@yahoo.com"
  
      oIFS="$IFS"; 
      IFS=';' 
      set -A str $string
      IFS="$oIFS"
  }
  
  splitString
  echo "strings count = ${#str[@]}"
  echo "first : ${str[0]}";
  echo "second: ${str[1]}";
  echo "third : ${str[2]}";
  </code></pre>
  
  <p>Now the <code>echo</code> does not print out the values of the array, so I assume it has something to do with the scope of the array defined. </p>
  
  <p>I am new to Shell scripting, can anybody help me out with understanding the scope of variables in the example above?</p>