Perl Quiz (Set 5) Perl (Set 5) 1 / 10 What is the purpose of the 'reverse' function in Perl? Reverses the order of elements in an array Converts a string to uppercase Reverses the characters in a string Removes whitespace from a string 2 / 10 In Perl, what does the 'redo' statement do within a loop? Terminates the loop Restarts the current iteration of the loop Exits the loop immediately Jumps to the end of the loop body 3 / 10 What does the Perl 'gt' operator do? Assigns a value to a variable Checks if a string is empty Performs a bitwise AND operation Compares if one string is greater than another 4 / 10 Which function is used to sort elements of an array in Perl? sort() order() arrange() sequence() 5 / 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); 6 / 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 7 / 10 Which Perl function is used to reverse the order of elements in an array? reverse_array() flip() reverse() invert() 8 / 10 In Perl, what does the 'local' keyword indicate? A global variable A reserved keyword A temporary change to a global variable's value A loop statement 9 / 10 What is the purpose of the 'die' function in Perl? Exits the loop immediately Terminates the program with an error message Prints a warning message Skips the current iteration of a loop 10 / 10 In Perl, what does the 'shift' function do? Removes the first element of an array Adds an element to the end of an array Reverses the elements of an array Removes the last element of an array Your score isThe average score is 0% 0% Restart quiz