Perl Quiz (Set 16) Perl (Set 6) 1 / 10 In Perl, what does the 'each' function do? Returns the current element of an array Returns the index of the current element in an array Returns the number of elements in an array Returns the current key-value pair from a hash 2 / 10 What is the purpose of the 'join' function in Perl? Splits a string into an array Joins multiple strings into one Removes whitespace from a string Replaces substrings in a string 3 / 10 Which Perl function is used to reverse the order of elements in an array? reverse_array() flip() reverse() invert() 4 / 10 In Perl, what does the 'local' keyword indicate? A global variable A reserved keyword A loop statement A temporary change to a global variable's value 5 / 10 What is the purpose of the 'grep' function in Perl? Filters elements of an array based on a condition Searches for a substring in a string Replaces substrings in a string Counts the occurrences of a character in a string 6 / 10 In Perl, how do you remove an element from an array? remove(array, index); delete(array, index); splice(array, index, 1); pop(array); 7 / 10 What is the purpose of the 'keys' function in Perl? Extracts the values from a hash Returns a list of keys from a hash Finds the average of numeric values Searches for a key in a hash 8 / 10 In Perl, how do you declare a hash? %hash = (key1 => value1, key2 => value2); @hash = (key1 => value1, key2 => value2); $hash = (key1 => value1, key2 => value2); &hash = (key1 => value1, key2 => value2); 9 / 10 What is the Perl 'cmp' operator used for? Compares if two strings are equal Compares if two strings are not equal Compares two strings for equality, returning -1, 0, or 1 Compares two strings for length 10 / 10 In Perl, what is the purpose of the 'unless' statement? To exclude a module To perform conditional execution if a condition is false To execute a loop To define a subroutine Your score isThe average score is 0% 0% Restart quiz