#!/usr/bin/perl use strict; use warnings; local $\="\n"; for my $count (0..4) { print +([ sub () { "Whoa, it's $count" }, sub () { "Then it becomes $count" }, sub () { "Then, $count" }, sub () { "Only to further increase to $count" }, sub () { "And eventualy stop at $count" } ]->[$count] || sub () {} )->(); } __END__