I have a perl script, such as:
#!/usr/bin/perl -w
use strict;
my @vars = split(" ", "aaa bbb");
my @list = split(" ", "aaa");
foreach(@vars) {
if ( grep(/$_/, @list)) {
print "1\t";
}else{
print "0\t";
}
}
I was hoping it gives "1 0" in return, but it is always "1 1". Does anyone know why ? I am using perl 5.8.8.
Thanks.
Chun