use strict; use warnings; use feature qw( state ); while (my $code = get_code()) { print "Send email re: http code $code\n" if $code != 404 .. $code == 404; } sub get_code { state $codes = [ 200, 200, 404, 404, 404, 404, 200, 200, 404, 404, 200, ]; return shift @$codes; } #### 13:10 >perl 1861_SoPW.pl Send email re: http code 200 Send email re: http code 200 Send email re: http code 404 Send email re: http code 200 Send email re: http code 200 Send email re: http code 404 Send email re: http code 200 13:10 >