What is the difference between chop & chomp functions in perl?
Answer Posted / wicked_sunny
Chop and Chomp are two very similar functions. Both of them
are used to delete symbols from the tail of the given
string. While both work with string and list parameters,
Chop deletes any ending symbol Chomp deletes only specified
substring from the end. If you pass list to any of these
two, all list elements will get processed and the return
value would be the result of last operation.
| Is This Answer Correct ? | 22 Yes | 20 No |
Post New Answer View All Answers
What is lexical variable in perl?
What are numeric operators in perl?
Which feature of perl provides code reusability?
“Perl regular expressions match the longest string possible”. What is the name of this match?
List the files in current directory sorted by size ?
What is the different between array and hash in perl programming?
In Perl, there are some arguments that are used frequently. What are that arguments and what do they mean?
How to find the length of an array in perl?
package MYCALC; use Exporter; our @EXPORT = (); our @ISA = qw(Exporter); our @EXPORT_OK = qw(addition multi); our %EXPORT_TAGS = (DEFAULT => [qw(&addition)],Both => [qw(&addition & +multi)]); sub addition { return $_[0] + $_[1]; } sub multi { return $_[0] * $_[1]; } 1; Program: use strict; use warnings; my @list = qw (2 2); use Module qw(:DEFAULT); print addition(@list),"\n"; Above coding is my module MYCALC and the program which using this module, I have not exported any function using @EXPORT, but I have used the DEFAULT in %EXPORT_TAGS with the function addition, when I call this function from the main it says the error as,
Explain goto label?
What are the logical operators used for small scale operations? Explain them briefly.
How to read file into hash array ?
How can you use Perl warnings and what is the importance to use them?
what are steps to do to lock the sony ericsson mobile with password?
How would you ensure the re-use and maximum readability of your perl code?