R
Rodion
Hi!
I got into a problem with looking up stuff in hasheshes, the sub is
supposed to check if $data is in the hash, and when found exit the loop,
as there is no need to go through the rest of the hash.
Only for some reason it exits immediately :?
the code:
--------
CODECHECK: while ( ($k,$v) = each %{$cb{$cbName}}) {
switch ($test){
case 'numbers' {
if ($data==$k){
$found=1;
last CODECHECK if ($found==1);
}
}
case 'text' {
if ($data eq $k){
$found=1;
last CODECHECK if ($found==1);
}
}
}
}
I got into a problem with looking up stuff in hasheshes, the sub is
supposed to check if $data is in the hash, and when found exit the loop,
as there is no need to go through the rest of the hash.
Only for some reason it exits immediately :?
the code:
--------
CODECHECK: while ( ($k,$v) = each %{$cb{$cbName}}) {
switch ($test){
case 'numbers' {
if ($data==$k){
$found=1;
last CODECHECK if ($found==1);
}
}
case 'text' {
if ($data eq $k){
$found=1;
last CODECHECK if ($found==1);
}
}
}
}