Perl中grep函数的作用

Perl中grep函数类似Java中contains方法:

#!/usr/bin/perl

print("start...\n");

if (5) {
print("5 is true in if conditon.\n");
}

print("----------- start to test ---------------\n");
my $tempStr = "SAAAA000000/AAA";
if (grep (/AAAA00000/, $tempStr)) {
	print("grep function in Perl like contains function in Java!\n");
}

print("end.\n");






执行结果:

Perl中grep函数的作用

你可能感兴趣的:(perl)