<p>In perl one would simply do the following to store and iterate over a list of names</p>

<pre><code>my @fruit = (apple, orange, kiwi);
foreach (@fruit) {
        print $_;
}
</code></pre>

<p>What would the equivalent be in bash?</p>

[{'answer_id': 78600, 'author': 'JBB', 'author_id': 12332, 'author_profile': 'https://Stackoverflow.com/users/12332', 'pm_score': 2, 'selected': False, 'text': '<pre>\nfor i in apple orange kiwi\ndo\n  echo $i\ndone\n</pre>\n'}, {'answer_id': 78601, 'author': 'emk', 'author_id': 12089, 'author_profile': 'https://Stackoverflow.com/users/12089', 'pm_score': 4, 'selected': False, 'text': '<p>Like this:</p>\n\n<pre><code>FRUITS="apple orange kiwi"\nfor FRUIT in $FRUITS; do\n  echo $FRUIT\ndone\n</code></pre>\n\n<p>Notice this won\'t work if there are spaces in the names of your fruits. In that case, see <a href="https://stackoverflow.com/questions/78592/what-is-a-good-equivalent-to-perl-lists-in-bash#78631">this answer</a> instead, which is slightly less portable but much more robust.</p>\n'}, {'answer_id': 78618, 'author': 'C. K. Young', 'author_id': 13, 'author_profile': 'https://Stackoverflow.com/users/13', 'pm_score': 3, 'selected': False, 'text': '<p>Now that the answer I like has been accepted as the correct answer, I\'ll now move into another topic: how to use <code>IFS</code> for personal gain. :-P</p>\n\n<pre><code>fruits="apple,orange,kiwifruit,dried mango"\n(IFS=,\n for fruit in $fruits; do\n     echo "$fruit"\n done)\n</code></pre>\n\n<p>I\'ve put the code in brackets so that the <code>IFS</code> change is isolated into its own subprocess; thus at the end of the bracketed section, <code>IFS</code> is reverted back to its old value. :-)</p>\n'}, {'answer_id': 78631, 'author': 'Charles Duffy', 'author_id': 14122, 'author_profile': 'https://Stackoverflow.com/users/14122', 'pm_score': 7, 'selected': True, 'text': '<p>bash (unlike POSIX sh) supports arrays:</p>\n\n<pre><code>fruits=(apple orange kiwi "dried mango")\nfor fruit in "${fruits[@]}"; do\n  echo "${fruit}"\ndone\n</code></pre>\n\n<p>This has the advantage that array elements may contain spaces or other members of $IFS; as long as they were correctly inserted as separate elements, they are read out the same way.</p>\n'}]
['https://Stackoverflow.com/questions/78592', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10747/']