in reply to check whether a array element is equal to a string.

Here is the syntax:

use strict; use warnings; use 5.010; my @answers = qw{yes no maybe}; for my $string (@answers) { say $string; #or do something else to $string }

Every element of @answers gets assigned to the variable $string in turn.

There are several perl functions that can be used to call external programs. system() is one of them. One respect in which the functions differ is in their return values.