undef default undefined character, Perl does not have null,defined ($x) function: If the argument is undef return false
QW (CS PHY Geo) is similar to the list of ("CS", "PHY", "GEO") that can be assigned to an array @array
Array operators: Pop,push the end of the operation, the Shift,unshift operation begins, reverse reverse order, @array = sort @array;
foreach @array {print $_;} Print an array; $_ is a very powerful default variable
Each action, returns a pair of @array (index, value), used in the while loop
Perl has an automatic fit for scalar and list contexts
Sub-set subroutine (function), the parameter will be in the @_ array, the caller can use the & symbol, not with the default function conflicts can be omitted, you can define in the function of the
A persistent private variable of a function, identified by state, that retains its last change each time the function is called
The scope of my qualified variable is current, and the generic definition variable is used with my
<STDIN> read the input file by line, default <> read all the files for the parameter list, \ n end for each row, you can use Chomp to remove \ n
printf can format output, sprintf more powerful
File handle: Open config, ' >>:utf8 ', ' filename ' or die ' failed: $! ', die throws an exception, produces output, close config;
Use file handles: Read files like while (<CONFIG>), change the default output file, select CONFIG; Print "123" to config file to replace the default stderr
Hash array: Key, value array, can assign value to array, expand Hash;reverse into VALUE=>KEY:%EVN environment variable
The keys%hash returns an array of keys, values%hash returns the array of values, and each returns the K, v;exists, delete functions
Powerful regular Expressions: \a represents the beginning, \z represents the end,/s matches any whitespace, and parentheses can capture the variable $, surviving until the next match succeeds;
No Capture mode:/(?: Bronto)? AAAA (bb| CC)/At this time represents BB or cc;/(? <name1>\w+)/named Capture, $+{name1};
Auto-capture variable: $ ' match before $& match to $ ' after matching variable;/xxxx/p Open capture variable: High version ${^match}
s///substitution, similar to SED, supports capture $1;\u conversion to uppercase
Split/Regular/, $string: Split string array; Join function, inverse process of split;
Non-greedy quantifiers: +?,*?,{8,}?, will not be greedy to match;/I ignore case,/m to match newline character
$^i = ". Bak" can update the file, open the file with Filename.bak open, and write back to the original file
Unless (con): Similar to if (!con); until: condition is false, repeat execution; last similar to Break;next Continue;redo return to the beginning of the loop body (new); tag
Various file Tester-E,-M the various information of the test file; stat $filename returns a series of information about a file; my @files = Glob "*": Current path All file names
String functions: index,substr advanced Sort @res = sort {$a <==> $b && $a cmp $b} @array
Smart match: ~: Matches the hash key, the array is the same
Given-when statement: Similar switch, have continue and break;
System plus commands to execute the subprocess; exec runs to another process, Perl no longer executes; the inverted quotes can capture the return value;
Support fork multiple processes; defined (my $pid = fork) or die "$!"; Unless ($pid) {child process work}; Support Send receive sig;
Slices: ($first, $last) = (sort @array) [0,-1], array, hash can, Eval catch error does not return;
Grep:my @array = grep {$_% 2} 1..1000; odd array; my @array = map {&big_money ($_)} @data; Manipulate each element in data; return list