Hi,
I tried the following code.I m trying 2 compare two strings.If its not matches, the while loop has to continue and if it matches, it will come out of the while loop.
But In my code, Even it matches the while loop continuing.
can anybody tell me where I am wrong?
[CODE=perl]
$flag=1;
LINEP:
while ($flag==1) {
print"Enter the lun name\n";
chomp($lunname= <stdin>);
foreach $line (@weblist) {
if ($line =~ m/$lunname/i) {
$flag=0;
print " found";
redo LINEP;
} else {
$flag=1;
redo LINEP;
}
}
}
[/CODE]
Thanks and Regards,
susi
I tried the following code.I m trying 2 compare two strings.If its not matches, the while loop has to continue and if it matches, it will come out of the while loop.
But In my code, Even it matches the while loop continuing.
can anybody tell me where I am wrong?
[CODE=perl]
$flag=1;
LINEP:
while ($flag==1) {
print"Enter the lun name\n";
chomp($lunname= <stdin>);
foreach $line (@weblist) {
if ($line =~ m/$lunname/i) {
$flag=0;
print " found";
redo LINEP;
} else {
$flag=1;
redo LINEP;
}
}
}
[/CODE]
Thanks and Regards,
susi
Comment