How do I compare two strings in Perl?
How do I compare two strings in Perl? I am learning Perl, I had this basic question looked it up here on StackOverflow and found no good answer so I thought I would ask. 7 Answers 7
How do I compare two strings in Perl? I am learning Perl, I had this basic question looked it up here on StackOverflow and found no good answer so I thought I would ask. 7 Answers 7
In Perl, what is a good way to perform a replacement on a string using a regular expression and store the value in a different variable, without changing the original? I usually just copy the string to a new variable then bind it to the s/// regex that does the replacement on the new string, … Read more
I know what my is in Perl. It defines a variable that exists only in the scope of the block in which it is defined. What does our do? How does our differ from my? 12 Answers 12
What are all the ways of affecting where Perl modules are searched for? or, How is Perl’s @INC constructed? As we know, Perl uses @INC array containing directory names to determine where to search for Perl module files. There does not seem to be a comprehensive “@INC” FAQ-type post on StackOverflow, so this question is … Read more
I get this error: Can’t locate Foo.pm in @INC Is there an easier way to install it than downloading, untarring, making, etc? 24 Answers 24
I have a file which contains several thousand numbers, each on it’s own line: 34 42 11 6 2 99 … I’m looking to write a script which will print the sum of all numbers in the file. I’ve got a solution, but it’s not very efficient. (It takes several minutes to run.) I’m looking … Read more
I have tried: $var = false; $var = FALSE; $var = False; None of these work. I get the error message Bareword “false” not allowed while “strict subs” is in use. 9 Answers 9
Can someone please help me? In Perl, what is the difference between: exec “command”; and system(“command”); and print `command`; Are there other ways to run shell commands too? 5 Answers 5
I seem to have come across several different ways to find the size of an array. What is the difference between these three methods? my @arr = (2); print scalar @arr; # First way to print array size print $#arr; # Second way to print array size my $arrSize = @arr; print $arrSize; # Third … Read more
I am trying to figure out a way of checking for the existence of a value in an array without iterating through the array. I am reading a file for a parameter. I have a long list of parameters I do not want to deal with. I placed these unwanted parameters in an array @badparams. … Read more