Perl | reset() Function Last Updated : 28 Feb, 2019 Comments Improve Suggest changes Like Article Like Report reset() function in Perl resets (clears) all package variables starting with the letter range specified by value passed to it. Generally it is used only within a continue block or at the end of a loop. Note: Use of reset() function is limited to variables which are not defined using my() function. Syntax: reset(letter_range) Parameter: letter_range: a range of letters that begin with a common character or a set of characters Returns: 1, and resets all the variable in the given range Example 1: perl #!/usr/bin/perl -w $var1 = 20; $var2 = 15; # Values before reset() function call print "var1 value = $var1, ", "var2 value = $var2\n"; # Now reset all variables whose # name starts with 'v' reset('v'); # Values after reset() function call print "var1 value = $var1, ", "var2 value = $var2\n"; Output: var1 value = 20, var2 value = 15 var1 value = , var2 value = Example 2: perl #!/usr/bin/perl -w $variable1 = 10; $variable2 = 30; # defining private variable using my() my $variable3 = 40; # Values before reset() function call print "variable1 value = $variable1, ", " variable2 value = $variable2\n"; print "variable3 value = $variable3\n"; # Now reset all variables whose # name starts with 'v' reset('v'); # Values after reset() function call print "variable1 value = $variable1, ", " variable2 value = $variable2, \n"; print "variable3 value = $variable3"; Output: variable1 value = 10, variable2 value = 30 variable3 value = 40 variable1 value = , variable2 value = , variable3 value = 40 In the code given in Example 2, variable 3 is defined using my() function and hence, its value shows no effect of the reset() function whereas other variable's values get reset. Comment More infoAdvertise with us Next Article Perl | reset() Function C Code_Mech Follow Improve Article Tags : Perl Perl-function Similar Reads Perl | return() Function return() function in Perl returns Value at the end of a subroutine, block, or do function. Returned value might be scalar, array, or a hash according to the selected context. Syntax: return Value Returns: a List in Scalar Context Note: If no value is passed to the return function then it returns an 2 min read Function Signature in Perl A Perl function or subroutine is a group of statements that together perform a specific task. In every programming language user want to reuse the code. So the user puts the section of code in function or subroutine so that there will be no need to write code again and again. In Perl, the terms func 5 min read Perl | Subroutines or Functions A Perl function or subroutine is a group of statements that together perform a specific task. In every programming language user want to reuse the code. So the user puts the section of code in function or subroutine so that there will be no need to write code again and again. In Perl, the terms func 2 min read Perl | delete() Function Delete() in Perl is used to delete the specified keys and their associated values from a hash, or the specified elements in the case of an array. This operation works only on individual elements or slices. Syntax: delete(LIST) Parameters: LIST which is to be deleted Returns: undef if the key does no 1 min read Perl | Tail Calls in Function Recursion Recursion in Perl is any function that does not uses the for loop or the while loop, instead calls itself during the execution of the program and the corresponding function is known as recursive function. Tail recursive function is a special case of recursion in which the function call statement is 5 min read Recursion in Perl Recursion is a mechanism when a function calls itself again and again till the required condition is met. When the function call statement is written inside the same function then such a function is referred to as a recursive function.The argument passed to a function is retrieved from the default a 3 min read Perl | redo operator redo operator in Perl restarts from the given label without evaluating the conditional statement. Once redo is called then no further statements will execute in that block. Even a continue block, if present, will not be executed after the redo call. If a Label is given with the redo operator then th 1 min read Ruby | Set reset() function The reset() is an inbuilt method in Ruby resets the internal state after modification to existing elements and returns self. The elements will be reindexed and deduplicated. Syntax: s1.reset() Parameters: The function does not accepts any parameter. Return Value: It returns self . Example 1: Ruby # 1 min read PHP reset() Function The reset() function is an inbuilt function in PHP. This function is used to move any array's internal pointer to the first element of that array. While working with arrays, it may happen that we modify the internal pointer of an array using different functions like prev() function, current() functi 2 min read bitset reset() function in C++ STL bitset::reset() is a built-in function in C++ STL which resets the bits at the given index in the parameter. If no parameter is passed then all the bits are reset to zero. Syntax: reset(int index) Parameter: The function accepts a parameter index which signifies the position at which the bit has to 2 min read Like