perl 正则表达式s///的2个疑问/usr/perl/binuse warnings;use strict;my $in=$ARGV[0];$out=$in;$out=~s/(\.w+)?$/\.out/; print $out;open LOG1,"$out"; $out=~s/(\.w+)?$/\.out/; 1.这一行为什么必须加上?才能匹配并且替换成.out,$out=~s
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/05 09:22:10
![perl 正则表达式s///的2个疑问/usr/perl/binuse warnings;use strict;my $in=$ARGV[0];$out=$in;$out=~s/(\.w+)?$/\.out/; print $out;open LOG1,](/uploads/image/z/8470510-70-0.jpg?t=perl+%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8Fs%2F%2F%2F%E7%9A%842%E4%B8%AA%E7%96%91%E9%97%AE%2Fusr%2Fperl%2Fbinuse+warnings%3Buse+strict%3Bmy+%24in%3D%24ARGV%5B0%5D%3B%24out%3D%24in%3B%24out%3D%7Es%2F%28%5C.w%2B%29%3F%24%2F%5C.out%2F%3B+print+%24out%3Bopen+LOG1%2C%22%24out%22%3B+%24out%3D%7Es%2F%28%5C.w%2B%29%3F%24%2F%5C.out%2F%3B+1.%E8%BF%99%E4%B8%80%E8%A1%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E5%BF%85%E9%A1%BB%E5%8A%A0%E4%B8%8A%3F%E6%89%8D%E8%83%BD%E5%8C%B9%E9%85%8D%E5%B9%B6%E4%B8%94%E6%9B%BF%E6%8D%A2%E6%88%90.out%2C%24out%3D%7Es)
xSMo@+C8S.*K!TQ:^*7)PH*Q PJ קή![913oy'WvHΎ,v
6vi5)J9W&H*q⁚J_Bߢ@\Y
<|كV:
;U
n/ޏh2r%q%sh+Gח/_lZǦƎ
ؼ#
[Y28G#oa39NHr2.YhlCHr8F_Ti 2sBO
*H̢?tכ)$eȿ̃h n5KK>J9n7|R4hI[BC<ꒃv$,'9"n Ɠ]ڐ *{xtIJHz;h#zB>(Āf+Ljx~3y-5#E Ӯ7