use strict; use warnings; local $_ = 'y,ys,sy,,s,ys,sy,'; my %h; my $i; for my $n (1 .. $ARGV[0] || 12) { $h{$_} ||= ++$i; print("State $h{$_}: $_\n"); eval; }