Finding a Substring with index
Finding a substring depends on where you have lost it. If you happen to have lost it within a bigger string, you』re in luck because the index function can help you out. Here』s how it … Read the rest
Finding a substring depends on where you have lost it. If you happen to have lost it within a bigger string, you』re in luck because the index function can help you out. Here』s how it … Read the rest
Your program runs with a 「working directory,」 which is the starting point for relative pathnames. That is, if you refer to the file fred, that means fred in the current working directory.
The chdir … Read the rest
Before we start a program that creates a new file, let』s make sure that the file doesn』t already exist so that we don』t accidentally overwrite a vital spreadsheet datafile or that important birthday calendar. For this, we … Read the rest
There is a lot more to Perl than what we』re able to show you in this book, and there are a lot of people doing a lot of interesting things with Perl. If there is a problem to solve, then … Read the rest
In an if
control structure, the block of code is executed only when the conditional expression is true
. If you want to execute a block of code only when the conditional is false
, change … Read the rest
If you think of the m//
pattern match as being like your word processor』s 「search」 feature, the 「search and replace」 feature would be Perl』s s///
substitution operator. This simply replaces whatever part of a variable matches a … Read the rest
We』ve been writing patterns in pairs of forward slashes, like /fred/
. But this is actually a shortcut for the m//
(pattern match) operator. As you saw with the qw//
operator, you may choose any pair of … Read the rest