This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#这个问题解决了: | |
#Most of the power comes from the implicit smartmatching | |
#that can sometimes apply. Most of the time, when(EXPR) is | |
#treated as an implicit smartmatch of $_ , that is, $_ ~~ EXPR . | |
#(See Smartmatch Operator in perlop for more information on smartmatching.) | |
#But when EXPR is one of the 10 exceptional cases | |
#(or things like them) listed below, it is used directly as a boolean. | |
#1. A user-defined subroutine call or a method invocation. | |
#其他省略 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
void | |
print_in_byte(void *a, int size){ | |
char *byte_ptr = (char *) a; | |
while (size--) { | |
printf("%.2x ", *byte_ptr++); | |
} | |
printf("\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#你在使用这个代码之前先要把输入文件转换成UTF-8的编码 | |
open $in, "<", "a.txt"; | |
while (<$in>) { | |
chomp; | |
( $city, $pinyin ) = split; | |
$city .= "市"; | |
$hash{$city} = $pinyin; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.010; | |
use strict; | |
use List::MoreUtils qw(pairwise); | |
use Text::Extract::Word; | |
sub foo { | |
sprintf "%.3d", shift; | |
} |