# Directory Operations

### Moving Around the Directory Tree

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

# File Tests

### File Test Operators

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

# Perl Modules

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

# More Control Structures

### The unless Control Structure

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

# Processing Text with Regular Expressions

### Substitutions with s///

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

# Matching with Regular Expression

### Matches with m//

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

# Regex basics

### Using Simple Patterns

To match a pattern (regular expression) against the contents of $_, simply put the pattern between a pair of forward slashes (/), like we do here: $_ = "yabba dabba doo";
if (/abba/) {
print "It 

# Hashes

### Hash Element Access

To access an element of a hash, use syntax that looks like this:
$hash{$some_key}
This is similar to what we used for array access, but here we use curly braces instead of square brackets around the subscript(key). … Read the rest

# Vim auto set paste mode and nopaste mode

There has been a lot of time that i encountered a paste issue in vim insert mode. When copying some plain text and then go to terminal vim, set vim in insert mode, press Command+V, i always get extra characters … Read the rest

# Input and Output

### Input from Standard Input

chomp($line = <STDIN>); # read the next line and chomp it Since the line-input operator will return undef when you reach end-of-file, this is handy for dropping out of loops: while (defined($line = <STDIN>)) {
print