- $string = join(" ","this","is","a","string");
- @list = ("words","and");
- @string = join("::","@list","color");
- print "@string\n"; #words and::color
- @string = join("::",@list,"color");
- print "@string\n"; #words::and::color
- @array = split(/::/,$string);
- print "@string\n"; #words::and::color
- 匹配输入
- my $string = "25abc8";
- $string =~ /abc/;
- $matched = $&; # $&当前匹配值
- print $matched ;
- perl 子函数传入参数
- sub sub1{
- my($number1, $number2, $number3) = @_; # 必须用 @_
- ...
- }