use strict; use warnings; my $var = $cgi->cookie('keks'); for (1..10) { $var = $_ if $_ eq $var; } print $var;